pub struct Rect {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}Expand description
Axis-aligned pixel rectangle. (x, y) is the top-left corner and (w, h) is its size.
Fields§
§x: u32§y: u32§w: u32§h: u32Implementations§
Source§impl Rect
impl Rect
pub const fn new(x: u32, y: u32, w: u32, h: u32) -> Self
pub const fn is_empty(self) -> bool
pub const fn area(self) -> u128
Sourcepub fn contains(self, inner: &Rect) -> bool
pub fn contains(self, inner: &Rect) -> bool
Returns whether inner is a positive-area rectangle fully inside this rectangle.
Sourcepub fn intersects(self, other: &Rect) -> bool
pub fn intersects(self, other: &Rect) -> bool
Returns whether two positive-area rectangles overlap. Touching edges do not overlap.
Trait Implementations§
impl Copy for Rect
impl Eq 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
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