pub struct LayoutRect {
pub x: i32,
pub y: i32,
pub width: u16,
pub height: u16,
}Expand description
A rectangle with signed origin and unsigned dimensions.
Used throughout the engine to represent both screen-space regions and floating-window geometry where off-screen coordinates are valid.
Fields§
§x: i32§y: i32§width: u16§height: u16Implementations§
Source§impl LayoutRect
impl LayoutRect
Sourcepub fn center(&self) -> (i32, i32)
pub fn center(&self) -> (i32, i32)
Centre point of the rectangle, rounding down on odd dimensions.
pub fn contains(&self, col: u16, row: u16) -> bool
pub fn clamp(self, bounds: LayoutRect) -> LayoutRect
pub fn visible_portion(self, bounds: LayoutRect) -> LayoutRect
pub fn intersects(self, other: LayoutRect) -> bool
Trait Implementations§
Source§impl Clone for LayoutRect
impl Clone for LayoutRect
Source§fn clone(&self) -> LayoutRect
fn clone(&self) -> LayoutRect
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for LayoutRect
Source§impl Debug for LayoutRect
impl Debug for LayoutRect
impl Eq for LayoutRect
Source§impl PartialEq for LayoutRect
impl PartialEq for LayoutRect
Source§fn eq(&self, other: &LayoutRect) -> bool
fn eq(&self, other: &LayoutRect) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for LayoutRect
Auto Trait Implementations§
impl Freeze for LayoutRect
impl RefUnwindSafe for LayoutRect
impl Send for LayoutRect
impl Sync for LayoutRect
impl Unpin for LayoutRect
impl UnsafeUnpin for LayoutRect
impl UnwindSafe for LayoutRect
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