pub struct Rect {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}Expand description
A rectangle in cells (cell model) or pixels (graphics model).
Fields§
§x: u32§y: u32§w: u32§h: u32Implementations§
Source§impl Rect
impl Rect
pub const fn new(x: u32, y: u32, w: u32, h: u32) -> Self
pub const fn is_empty(&self) -> bool
pub const fn right(&self) -> u32
pub const fn bottom(&self) -> u32
pub const fn area(&self) -> u64
Sourcepub fn clamp(self, width: u32, height: u32) -> Option<Self>
pub fn clamp(self, width: u32, height: u32) -> Option<Self>
The part inside a width by height surface, or None.
pub fn contains_rect(&self, other: &Self) -> bool
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