[][src]Struct cursive::Rect

pub struct Rect { /* fields omitted */ }

A non-empty rectangle on the 2D grid.

Implementations

impl Rect[src]

pub fn from_size<U, V>(top_left: U, size: V) -> Rect where
    U: Into<XY<usize>>,
    V: Into<XY<usize>>, 
[src]

Creates a new Rect with the given position and size.

The minimum size will (1, 1).

pub fn from_corners<U, V>(a: U, b: V) -> Rect where
    U: Into<XY<usize>>,
    V: Into<XY<usize>>, 
[src]

Creates a new Rect from two corners.

It can be any two opposite corners.

pub fn expand_to<R>(&mut self, other: R) where
    R: Into<Rect>, 
[src]

Grow this rectangle if necessary to include other.

pub fn expanded_to<R>(self, other: R) -> Rect where
    R: Into<Rect>, 
[src]

Returns a new rectangle that includes both self and other.

pub fn side(self, orientation: Orientation) -> (usize, usize)[src]

Returns the start and end coordinate of one side of this rectangle.

Both start and end are inclusive.

pub fn edge(self, side: Absolute) -> usize[src]

Returns the coordinate of the given edge.

All edges are inclusive.

pub fn offset<V>(&mut self, offset: V) where
    V: Into<XY<usize>>, 
[src]

Adds the given offset to this rectangle.

pub fn size(self) -> XY<usize>[src]

Returns the size of the rectangle.

pub fn width(self) -> usize[src]

Returns the width of the rectangle.

pub fn height(self) -> usize[src]

Returns the height of the rectangle.

pub fn top_left(self) -> XY<usize>[src]

Returns the top-left corner.

This is inclusive.

pub fn bottom_right(self) -> XY<usize>[src]

Returns the bottom-right corner.

This is inclusive.

pub fn top_right(self) -> XY<usize>[src]

Returns the top-right corner.

This is inclusive.

pub fn bottom_left(self) -> XY<usize>[src]

Returns the bottom-left corner.

This is inclusive.

pub fn top(self) -> usize[src]

Returns the Y value of the top edge of the rectangle.

This is inclusive.

pub fn left(self) -> usize[src]

Returns the X value of the left edge of the rectangle.

This is inclusive.

pub fn right(self) -> usize[src]

Returns the X value of the right edge of the rectangle.

This is inclusive.

pub fn bottom(self) -> usize[src]

Returns the Y value of the botton edge of the rectangle.

This is inclusive.

pub fn surface(self) -> usize[src]

Returns the surface (number of cells) covered by the rectangle.

pub fn contains(self, point: XY<usize>) -> bool[src]

Checks if a point is in self.

Trait Implementations

impl<T> Add<T> for Rect where
    T: Into<XY<usize>>, 
[src]

type Output = Rect

The resulting type after applying the + operator.

impl Clone for Rect[src]

impl Copy for Rect[src]

impl Debug for Rect[src]

impl Eq for Rect[src]

impl<T> From<T> for Rect where
    T: Into<XY<usize>>, 
[src]

impl Hash for Rect[src]

impl PartialEq<Rect> for Rect[src]

impl StructuralEq for Rect[src]

impl StructuralPartialEq for Rect[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> CallHasher for T where
    T: Hash + ?Sized
[src]

impl<T> Erased for T

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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> With for T[src]