pub struct Rect {
pub x: u32,
pub y: u32,
pub w: u32,
pub h: u32,
}Expand description
An axis-aligned rectangle, in pixels.
An empty rectangle (w == 0 or h == 0) is never drawable and is what
clipping operations return when nothing remains.
Fields§
§x: u32§y: u32§w: u32§h: u32Implementations§
Source§impl Rect
impl Rect
pub const EMPTY: Self
pub const fn new(x: u32, y: u32, w: u32, h: u32) -> Self
pub const fn is_empty(self) -> bool
Sourcepub const fn right(self) -> u32
pub const fn right(self) -> u32
One past the last column. Saturates instead of wrapping, so a bogus
x + w can never turn into a rectangle on the other side of zero.
pub const fn area(self) -> u64
pub const fn contains_point(self, x: u32, y: u32) -> bool
pub const fn contains_rect(self, other: Rect) -> bool
Sourcepub const fn intersect(self, other: Rect) -> Rect
pub const fn intersect(self, other: Rect) -> Rect
The overlap of two rectangles (empty when they do not overlap).
Sourcepub const fn union(self, other: Rect) -> Rect
pub const fn union(self, other: Rect) -> Rect
The smallest rectangle containing both. An empty operand is ignored.
Sourcepub const fn is_adjacent(self, other: Rect) -> bool
pub const fn is_adjacent(self, other: Rect) -> bool
True when the two rectangles share a full edge (no overlap and no
gap). Used by RectSet to coalesce glyph rows without covering
clean pixels.
Trait Implementations§
impl Copy for Rect
impl Eq for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Forget for Rect
impl Freeze for Rect
impl Move 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