[−][src]Struct cursive::Rect
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]
U: Into<XY<usize>>,
V: Into<XY<usize>>,
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]
U: Into<XY<usize>>,
V: Into<XY<usize>>,
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]
R: Into<Rect>,
Grow this rectangle if necessary to include other
.
pub fn expanded_to<R>(self, other: R) -> Rect where
R: Into<Rect>,
[src]
R: Into<Rect>,
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]
V: Into<XY<usize>>,
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]
T: Into<XY<usize>>,
type Output = Rect
The resulting type after applying the +
operator.
pub fn add(self, rhs: T) -> Rect
[src]
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]
T: Into<XY<usize>>,
impl Hash for Rect
[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Rect> for Rect
[src]
impl StructuralEq for Rect
[src]
impl StructuralPartialEq for Rect
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rect
[src]
impl Send for Rect
[src]
impl Sync for Rect
[src]
impl Unpin for Rect
[src]
impl UnwindSafe for Rect
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CallHasher for T where
T: Hash + ?Sized,
[src]
T: Hash + ?Sized,
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> With for T
[src]
pub fn wrap_with<U, F>(self, f: F) -> U where
F: FnOnce(Self) -> U,
[src]
F: FnOnce(Self) -> U,
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
pub fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
pub fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),