[][src]Struct winconsole::console::Rect

pub struct Rect {
    pub top: u16,
    pub bottom: u16,
    pub left: u16,
    pub right: u16,
}

Defines the coordinates of the corners of a rectangle.

Fields

top: u16

The top of the rectangle.

bottom: u16

The bottom of the rectangle.

left: u16

The left of the rectangle.

right: u16

The right of the rectangle.

Methods

impl Rect[src]

pub fn new(top: u16, left: u16, right: u16, bottom: u16) -> Rect[src]

Creates a new Rect.

pub fn bottom_left(self) -> Vector2<u16>[src]

Returns a Vector representing the bottom-left corner of the rectangle.

Examples

let rect = Rect::new(0, 10, 20, 30);
let bottom_left = rect.bottom_left();
assert_eq!(bottom_left, Vector2::new(10, 30))

pub fn bottom_right(self) -> Vector2<u16>[src]

Returns a Vector representing the bottom-right corner of the rectangle.

Examples

let rect = Rect::new(0, 10, 20, 30);
let bottom_right = rect.bottom_right();
assert_eq!(bottom_right, Vector2::new(20, 30))

pub fn top_left(self) -> Vector2<u16>[src]

Returns a Vector representing the top-left corner of the rectangle.

Examples

let rect = Rect::new(0, 10, 20, 30);
let top_left = rect.top_left();
assert_eq!(top_left, Vector2::new(10, 0));

pub fn top_right(self) -> Vector2<u16>[src]

Returns a Vector representing the top-right corner of the rectangle.

Examples

let rect = Rect::new(0, 10, 20, 30);
let top_right = rect.top_right();
assert_eq!(top_right, Vector2::new(20, 0));

Trait Implementations

impl PartialEq<Rect> for Rect[src]

impl Clone for Rect[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for Rect[src]

impl Debug for Rect[src]

impl Serialize for Rect[src]

impl<'de> Deserialize<'de> for Rect[src]

Auto Trait Implementations

impl Send for Rect

impl Sync for Rect

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]