pub struct Rect { /* private fields */ }Expand description
A validated axis-aligned rectangle using half-open pixel coordinates.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn new(
left: f32,
top: f32,
right: f32,
bottom: f32,
) -> Result<Self, GeometryError>
pub fn new( left: f32, top: f32, right: f32, bottom: f32, ) -> Result<Self, GeometryError>
Creates a rectangle from finite, non-inverted bounds.
§Errors
Returns GeometryError::NonFinite when any bound is NaN or infinite,
and GeometryError::InvertedBounds when the right or bottom edge
precedes its opposite edge.
Sourcepub fn intersection(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
Returns the geometric intersection, including a valid zero-area result when the rectangles are disjoint or only touch at an edge.
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