pub struct Rect<T = f32> {
pub x: T,
pub y: T,
pub width: T,
pub height: T,
}Expand description
An axis-aligned rectangle given by its top-left corner and its size.
Fields§
§x: TLeft edge.
y: TTop edge.
width: TWidth.
height: THeight.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn contains(self, point: Point) -> bool
pub fn contains(self, point: Point) -> bool
Whether point lies inside, counting the top and left edges but not the bottom and
right ones, so adjacent rectangles never both contain a point.
Sourcepub fn intersection(self, other: Self) -> Option<Self>
pub fn intersection(self, other: Self) -> Option<Self>
The overlap of two rectangles, or None when they share no area.
Trait Implementations§
impl<T: Copy> Copy for Rect<T>
impl<T: Eq> Eq for Rect<T>
impl<T: PartialEq> StructuralPartialEq for Rect<T>
Auto Trait Implementations§
impl<T> Forget for Rect<T>
impl<T> Freeze for Rect<T>where
T: Freeze,
impl<T> Move for Rect<T>
impl<T> RefUnwindSafe for Rect<T>where
T: RefUnwindSafe,
impl<T> Send for Rect<T>where
T: Send,
impl<T> Sync for Rect<T>where
T: Sync,
impl<T> Unpin for Rect<T>where
T: Unpin,
impl<T> UnsafeUnpin for Rect<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Rect<T>where
T: UnwindSafe,
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