#[repr(C)]pub struct Rect<T = f32> {
pub origin: Point<T>,
pub size: Size<T>,
}Expand description
Axis-Aligned Bounding Box (AABB) Rectangle.
Fields§
§origin: Point<T>§size: Size<T>Implementations§
Source§impl Rect<f32>
impl Rect<f32>
pub const ZERO: Self
pub const fn from_xywh(x: f32, y: f32, width: f32, height: f32) -> Self
pub fn x(self) -> f32
pub fn y(self) -> f32
pub fn width(self) -> f32
pub fn height(self) -> f32
pub fn min_x(self) -> f32
pub fn max_x(self) -> f32
pub fn min_y(self) -> f32
pub fn max_y(self) -> f32
pub fn contains_point(self, p: Point<f32>) -> bool
pub fn intersects(self, other: Self) -> bool
Sourcepub fn intersection(self, other: Self) -> Option<Self>
pub fn intersection(self, other: Self) -> Option<Self>
Computes intersection rect with another rectangle.
Sourcepub fn union(self, other: Self) -> Self
pub fn union(self, other: Self) -> Self
Computes minimal bounding rect containing both rectangles.
Sourcepub fn deflate(self, insets: EdgeInsets<f32>) -> Self
pub fn deflate(self, insets: EdgeInsets<f32>) -> Self
Deflates rectangle by insets (e.g. for padding/borders).
Sourcepub fn inflate(self, insets: EdgeInsets<f32>) -> Self
pub fn inflate(self, insets: EdgeInsets<f32>) -> Self
Inflates rectangle by insets (e.g. for margins/hit-testing).
Trait Implementations§
impl<T: Copy> Copy 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>
impl<T> Move for Rect<T>
impl<T> RefUnwindSafe for Rect<T>
impl<T> Send for Rect<T>
impl<T> Sync for Rect<T>
impl<T> Unpin for Rect<T>
impl<T> UnsafeUnpin for Rect<T>
impl<T> UnwindSafe for Rect<T>
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