#[repr(C)]pub struct Rect<T> {
pub left: T,
pub top: T,
pub width: T,
pub height: T,
}
Expand description
Utility type for manipulating 2D axis-aligned rectangles.
Fields§
§left: T
Left coordinate of the rectangle.
top: T
Top coordinate of the rectangle.
width: T
Width of the rectangle.
height: T
Height of the rectangle.
Implementations§
Source§impl<T: PartialOrd + Add<Output = T> + Sub<Output = T> + Copy> Rect<T>
impl<T: PartialOrd + Add<Output = T> + Sub<Output = T> + Copy> Rect<T>
Sourcepub fn contains(self, point: Vector2<T>) -> bool
pub fn contains(self, point: Vector2<T>) -> bool
Check if a point is inside the rectangle’s area.
Sourcepub fn intersects(self, other: &Rect<T>) -> Option<Rect<T>>
pub fn intersects(self, other: &Rect<T>) -> Option<Rect<T>>
Check the intersection between two rectangles.
If the rectangles intersect, returns Some filled with the intersection of the two rectangles. Otherwise, returns None.
Trait Implementations§
Source§impl<T: Ord> Ord for Rect<T>
impl<T: Ord> Ord for Rect<T>
Source§impl<T: PartialOrd> PartialOrd for Rect<T>
impl<T: PartialOrd> PartialOrd for Rect<T>
impl<T: Copy> Copy for Rect<T>
impl<T: Eq> Eq for Rect<T>
impl<T> StructuralPartialEq for Rect<T>
Auto Trait Implementations§
impl<T> Freeze for Rect<T>where
T: Freeze,
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> 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