pub struct Rect {
pub origin: Point,
pub width: i32,
pub height: i32,
}Expand description
A rectangle defined by its top-left corner and size.
Fields§
§origin: PointTop-left corner
width: i32Width
height: i32Height
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn from_points(top_left: Point, bottom_right: Point) -> Self
pub fn from_points(top_left: Point, bottom_right: Point) -> Self
Creates a rectangle from two points.
Sourcepub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
Returns whether the rectangle contains the given point.
Sourcepub fn intersects(&self, other: &Rect) -> bool
pub fn intersects(&self, other: &Rect) -> bool
Returns whether this rectangle intersects with another.
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