pub struct Rect {
pub origin: Point,
pub size: Size,
}Expand description
An axis-aligned rectangle in logical pixels.
Fields§
§origin: PointTop-left corner.
size: SizeWidth and height.
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn new(x: f32, y: f32, width: f32, height: f32) -> Self
pub const fn new(x: f32, y: f32, width: f32, height: f32) -> Self
Creates a rectangle from its top-left corner and dimensions, in logical pixels.
Sourcepub const fn from_origin_size(origin: Point, size: Size) -> Self
pub const fn from_origin_size(origin: Point, size: Size) -> Self
Creates a rectangle from a top-left corner and a size.
Sourcepub fn contains(&self, p: Point) -> bool
pub fn contains(&self, p: Point) -> bool
Half-open containment: the left/top edges are inside, the right/bottom edges are not.
Sourcepub fn inflate(&self, amount: f32) -> Self
pub fn inflate(&self, amount: f32) -> Self
Grows the rectangle by amount on every side (shrinks for negative values).
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