pub struct Rect {
pub x: u16,
pub y: u16,
pub width: u16,
pub height: u16,
}Expand description
A rectangular area on the screen.
Fields§
§x: u16§y: u16§width: u16§height: u16Implementations§
Source§impl Rect
impl Rect
pub fn new(x: u16, y: u16, width: u16, height: u16) -> Self
Sourcepub fn clamp_to(&self, other: Rect) -> Rect
pub fn clamp_to(&self, other: Rect) -> Rect
Clamp this rectangle to fit within another rectangle.
Sourcepub fn shrink(&self, amount: u16) -> Rect
pub fn shrink(&self, amount: u16) -> Rect
Shrink the rectangle by the given amount on all sides.
Sourcepub fn split_horizontally(&self, at: u16) -> (Rect, Rect)
pub fn split_horizontally(&self, at: u16) -> (Rect, Rect)
Split the rectangle horizontally (top/bottom) at the given row offset.
Sourcepub fn split_vertically(&self, at: u16) -> (Rect, Rect)
pub fn split_vertically(&self, at: u16) -> (Rect, Rect)
Split the rectangle vertically (left/right) at the given column offset.
Trait Implementations§
impl Copy for Rect
impl Eq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnsafeUnpin for Rect
impl UnwindSafe for Rect
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.