pub struct Rect {
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
}Expand description
An axis-aligned rectangle with u32 coordinates.
Uses u32 rather than u16 to avoid overflow bugs that affect other TUI
libraries on large terminals. All coordinates are in terminal columns and
rows, with (0, 0) at the top-left.
Note: Rect::right and Rect::bottom return exclusive bounds
(one past the last column/row), consistent with Rust range conventions.
Fields§
§x: u32Left edge column, inclusive.
y: u32Top edge row, inclusive.
width: u32Width in terminal columns.
height: u32Height in terminal rows.
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(x: u32, y: u32, width: u32, height: u32) -> Self
pub const fn new(x: u32, y: u32, width: u32, height: u32) -> Self
Create a new rectangle from position and size.
Sourcepub const fn right(&self) -> u32
pub const fn right(&self) -> u32
Exclusive right edge (x + width).
This is one column past the last column in the rectangle.
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