pub struct Rect {
pub x0: f32,
pub y0: f32,
pub x1: f32,
pub y1: f32,
}Expand description
An axis-aligned rectangle described by two opposite corners
(x0, y0) and (x1, y1).
A rectangle is normalized when x0 <= x1 and y0 <= y1. Operations
that depend on orientation (Rect::union, Rect::intersect,
Rect::contains) treat their inputs as if normalized.
Fields§
§x0: f32§y0: f32§x1: f32§y1: f32Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> Rect
pub const fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> Rect
Creates a rectangle from two opposite corners.
Sourcepub fn intersect(self, other: Rect) -> Option<Rect>
pub fn intersect(self, other: Rect) -> Option<Rect>
Overlapping area of self and other, or None if they are
disjoint. Rectangles that merely touch yield a degenerate
(zero-width or zero-height) rectangle.
Trait Implementations§
impl Copy 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