pub struct Rect {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}
Expand description
Rectangle.
Fields§
§x: f32
X coordinate of the top-left corner.
y: f32
Y coordinate of the top-left corner.
width: f32
Width of the rectangle.
height: f32
Height of the rectangle.
Implementations§
Source§impl Rect
impl Rect
Sourcepub fn intersection(&self, other: &Rect) -> Rect
pub fn intersection(&self, other: &Rect) -> Rect
Sourcepub fn clamp(&self, width: f32, height: f32) -> Rect
pub fn clamp(&self, width: f32, height: f32) -> Rect
Clamps the rectangle to the given rect. If the rectangle is larger than the given size, it will be shrunk.
§Arguments
width
- Width to clamp to.height
- Height to clamp to.
Trait Implementations§
impl Copy 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more