Struct cursive::rect::Rect [−][src]
pub struct Rect { /* fields omitted */ }
A non-empty rectangle on the 2D grid.
Methods
impl Rect
[src]
impl Rect
pub fn from_size<U, V>(top_left: U, size: V) -> Self where
U: Into<Vec2>,
V: Into<Vec2>,
[src]
pub fn from_size<U, V>(top_left: U, size: V) -> Self where
U: Into<Vec2>,
V: Into<Vec2>,
Creates a new Rect
with the given position and size.
size
must be non-zero in each axis.
pub fn from_corners<U, V>(a: U, b: V) -> Self where
U: Into<Vec2>,
V: Into<Vec2>,
[src]
pub fn from_corners<U, V>(a: U, b: V) -> Self where
U: Into<Vec2>,
V: Into<Vec2>,
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]
pub fn expand_to<R>(&mut self, other: R) where
R: Into<Rect>,
Grow this rectangle if necessary to include other
.
pub fn expanded_to<R>(self, other: R) -> Self where
R: Into<Rect>,
[src]
pub fn expanded_to<R>(self, other: R) -> Self where
R: Into<Rect>,
Returns a new rectangle that includes both self
and other
.
pub fn offset<V>(&mut self, offset: V) where
V: Into<Vec2>,
[src]
pub fn offset<V>(&mut self, offset: V) where
V: Into<Vec2>,
Adds the given offset to this rectangle.
pub fn size(self) -> Vec2
[src]
pub fn size(self) -> Vec2
Returns the size of the rectangle.
pub fn width(self) -> usize
[src]
pub fn width(self) -> usize
Returns the width of the rectangle.
pub fn height(self) -> usize
[src]
pub fn height(self) -> usize
Returns the height of the rectangle.
pub fn top_left(self) -> Vec2
[src]
pub fn top_left(self) -> Vec2
Returns the top-left corner.
pub fn bottom_right(self) -> Vec2
[src]
pub fn bottom_right(self) -> Vec2
Returns the bottom-right corner.
pub fn top_right(self) -> Vec2
[src]
pub fn top_right(self) -> Vec2
Returns the top-right corner.
pub fn bottom_left(self) -> Vec2
[src]
pub fn bottom_left(self) -> Vec2
Returns the bottom-left corner.
pub fn top(self) -> usize
[src]
pub fn top(self) -> usize
Returns the Y value of the top edge of the rectangle.
This is inclusive.
pub fn left(self) -> usize
[src]
pub fn left(self) -> usize
Returns the X value of the left edge of the rectangle.
This is inclusive.
pub fn right(self) -> usize
[src]
pub fn right(self) -> usize
Returns the X value of the right edge of the rectangle.
This is inclusive.
pub fn bottom(self) -> usize
[src]
pub fn bottom(self) -> usize
Returns the Y value of the botton edge of the rectangle.
This is inclusive.
pub fn surface(self) -> usize
[src]
pub fn surface(self) -> usize
Returns the surface (number of cells) covered by the rectangle.
pub fn contains(self, point: Vec2) -> bool
[src]
pub fn contains(self, point: Vec2) -> bool
Checks if a point is in self
.
Trait Implementations
impl Debug for Rect
[src]
impl Debug for Rect
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Rect
[src]
impl Clone for Rect
fn clone(&self) -> Rect
[src]
fn clone(&self) -> Rect
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Rect
[src]
impl Copy for Rect
impl PartialEq for Rect
[src]
impl PartialEq for Rect
fn eq(&self, other: &Rect) -> bool
[src]
fn eq(&self, other: &Rect) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rect) -> bool
[src]
fn ne(&self, other: &Rect) -> bool
This method tests for !=
.
impl Eq for Rect
[src]
impl Eq for Rect
impl<T> From<T> for Rect where
T: Into<Vec2>,
[src]
impl<T> From<T> for Rect where
T: Into<Vec2>,
impl<T> Add<T> for Rect where
T: Into<Vec2>,
[src]
impl<T> Add<T> for Rect where
T: Into<Vec2>,