pub struct Rect {
pub x: u16,
pub y: u16,
pub w: u16,
pub h: u16,
}Expand description
An axis-aligned rectangle in a discrete cell grid. x/y are the
top-left origin; w/h are width/height. A zero-area rect is legal
(it models a pane squeezed out of a too-small window) but
Rect::is_empty flags it so renderers can skip it.
Fields§
§x: u16§y: u16§w: u16§h: u16Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(x: u16, y: u16, w: u16, h: u16) -> Self
pub const fn new(x: u16, y: u16, w: u16, h: u16) -> Self
A rect at the origin with the given size — the usual window-root
bounding box (Rect::new(0, 0, cols, rows)).
Sourcepub const fn right(self) -> u32
pub const fn right(self) -> u32
The x coordinate one past the right edge (x + w). Widened to
u32 so a full-width rect at a high x cannot wrap.
Trait Implementations§
impl Copy for Rect
Source§impl<'de> Deserialize<'de> for Rect
impl<'de> Deserialize<'de> for Rect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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