pub struct Rect {
pub position: Position,
pub size: Size,
}Expand description
A rectangle defined by position and size.
Fields§
§position: PositionTop-left position.
size: SizeDimensions.
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn contains(self, pos: Position) -> bool
pub const fn contains(self, pos: Position) -> bool
Returns true if the point is inside this rectangle.
Sourcepub const fn intersects(self, other: &Rect) -> bool
pub const fn intersects(self, other: &Rect) -> bool
Returns true if two rectangles overlap.
Sourcepub fn intersection(self, other: &Rect) -> Option<Rect>
pub fn intersection(self, other: &Rect) -> Option<Rect>
Returns the intersection of two rectangles, or None if they don’t overlap.
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