pub struct Rectangle<T = f32> {
pub x: T,
pub y: T,
pub width: T,
pub height: T,
}
Expand description
A rectangle.
Fields§
§x: T
X coordinate of the top-left corner.
y: T
Y coordinate of the top-left corner.
width: T
Width of the rectangle.
height: T
Height of the rectangle.
Implementations§
source§impl Rectangle<f32>
impl Rectangle<f32>
sourcepub fn is_within(&self, container: &Rectangle) -> bool
pub fn is_within(&self, container: &Rectangle) -> bool
Returns true if the current Rectangle
is completely within the given
container
.
sourcepub fn intersection(&self, other: &Rectangle<f32>) -> Option<Rectangle<f32>>
pub fn intersection(&self, other: &Rectangle<f32>) -> Option<Rectangle<f32>>
Computes the intersection with the given Rectangle
.
sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Returns whether the Rectangle
intersects with the given one.
Trait Implementations§
source§impl Mul<Transformation> for Rectangle
impl Mul<Transformation> for Rectangle
source§impl<T: PartialEq> PartialEq for Rectangle<T>
impl<T: PartialEq> PartialEq for Rectangle<T>
impl<T: Copy> Copy for Rectangle<T>
impl<T: Eq> Eq for Rectangle<T>
impl<T> StructuralPartialEq for Rectangle<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Rectangle<T>where
T: RefUnwindSafe,
impl<T> Send for Rectangle<T>where
T: Send,
impl<T> Sync for Rectangle<T>where
T: Sync,
impl<T> Unpin for Rectangle<T>where
T: Unpin,
impl<T> UnwindSafe for Rectangle<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