pub struct Rect {
pub x: u16,
pub y: u16,
pub w: u16,
pub h: u16,
}Expand description
A rectangular region defined by position and size.
Provides methods for splitting, containment checks, and layout calculations.
Fields§
§x: u16X coordinate of the top-left corner.
y: u16Y coordinate of the top-left corner.
w: u16Width of the rectangle.
h: u16Height of the rectangle.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn contains(&self, x: u16, y: u16) -> bool
pub fn contains(&self, x: u16, y: u16) -> bool
Returns true if the point is within this rectangle.
Sourcepub fn display(self) -> DisplayRect
pub fn display(self) -> DisplayRect
Creates a DisplayRect for rendering within this rectangle.
Sourcepub fn with(self, property: impl RenderProperty) -> DisplayRect
pub fn with(self, property: impl RenderProperty) -> DisplayRect
Creates a DisplayRect with the given property applied.
Sourcepub fn v_split(&self, rule: impl SplitRule) -> (Self, Self)
pub fn v_split(&self, rule: impl SplitRule) -> (Self, Self)
Splits the rectangle vertically according to the given rule.
Returns (top, bottom) rectangles.
Sourcepub fn h_split(&self, rule: impl SplitRule) -> (Self, Self)
pub fn h_split(&self, rule: impl SplitRule) -> (Self, Self)
Splits the rectangle horizontally according to the given rule.
Returns (left, right) rectangles.
Sourcepub fn take_right(&mut self, rule: impl SplitRule) -> Self
pub fn take_right(&mut self, rule: impl SplitRule) -> Self
Removes and returns a portion from the right edge.
Sourcepub fn take_bottom(&mut self, rule: impl SplitRule) -> Self
pub fn take_bottom(&mut self, rule: impl SplitRule) -> Self
Removes and returns a portion from the bottom edge.
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