pub struct DamageRect {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}Expand description
An axis-aligned rectangle in f32 space. Coordinate system is up to
the caller — the library treats y as “down” only in the sense that
DamageRect::bottom returns y + height.
Fields§
§x: f32Left edge.
y: f32Top edge.
width: f32Width; must be non-negative.
height: f32Height; must be non-negative.
Implementations§
Source§impl DamageRect
impl DamageRect
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
Construct a new rectangle.
Negative width or height is not rejected but produces nonsense
from DamageRect::intersects and DamageRect::union; the
caller is responsible for ensuring non-negativity.
Sourcepub fn intersects(&self, other: &DamageRect) -> bool
pub fn intersects(&self, other: &DamageRect) -> bool
Whether self overlaps other (zero-area edge contact returns
false).
Sourcepub fn union(&self, other: &DamageRect) -> DamageRect
pub fn union(&self, other: &DamageRect) -> DamageRect
Smallest rectangle that contains both self and other.
Sourcepub fn contains_point(&self, px: f32, py: f32) -> bool
pub fn contains_point(&self, px: f32, py: f32) -> bool
Whether the point (px, py) lies inside self. Matches
half-open semantics: left/top inclusive, right/bottom exclusive.
Trait Implementations§
Source§impl Clone for DamageRect
impl Clone for DamageRect
Source§fn clone(&self) -> DamageRect
fn clone(&self) -> DamageRect
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DamageRect
impl Debug for DamageRect
Source§impl Display for DamageRect
impl Display for DamageRect
Source§impl PartialEq for DamageRect
impl PartialEq for DamageRect
impl Copy for DamageRect
impl StructuralPartialEq for DamageRect
Auto Trait Implementations§
impl Freeze for DamageRect
impl RefUnwindSafe for DamageRect
impl Send for DamageRect
impl Sync for DamageRect
impl Unpin for DamageRect
impl UnsafeUnpin for DamageRect
impl UnwindSafe for DamageRect
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