pub struct Rect {
pub origin: Point,
pub size: Size,
}Expand description
An axis-aligned rectangle in logical points.
Fields§
§origin: PointTop-left corner.
size: SizeExtent.
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(x: f64, y: f64, width: f64, height: f64) -> Self
pub const fn new(x: f64, y: f64, width: f64, height: f64) -> Self
Creates a rectangle from its top-left corner and size.
Sourcepub fn contains(&self, point: Point) -> bool
pub fn contains(&self, point: Point) -> bool
True when point lies inside the rectangle (inclusive of the top/left edge).
Sourcepub fn intersection(&self, other: &Self) -> Option<Self>
pub fn intersection(&self, other: &Self) -> Option<Self>
The overlapping region of two rectangles, if any.
Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Forget for Rect
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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