pub struct Rect {
pub x: u16,
pub y: u16,
pub width: u16,
pub height: u16,
}Expand description
A rectangle defined by position and size.
Fields§
§x: u16X coordinate (column) of the top-left corner.
y: u16Y coordinate (row) of the top-left corner.
width: u16Width in columns.
height: u16Height in rows.
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn from_size(width: u16, height: u16) -> Self
pub const fn from_size(width: u16, height: u16) -> Self
Create a rectangle from a terminal size (full screen).
Sourcepub const fn intersects(&self, other: &Self) -> bool
pub const fn intersects(&self, other: &Self) -> bool
Check if this rectangle intersects with another.
Sourcepub fn split_horizontal(&self, at: u16) -> (Self, Self)
pub fn split_horizontal(&self, at: u16) -> (Self, Self)
Split horizontally at a given column offset.
Sourcepub fn split_vertical(&self, at: u16) -> (Self, Self)
pub fn split_vertical(&self, at: u16) -> (Self, Self)
Split vertically at a given row 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 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