pub struct IntRect { /* private fields */ }
Expand description
An integer rectangle.
Guarantees
- Width and height are in 1..=i32::MAX range.
- x+width and y+height does not overflow.
Implementations§
source§impl IntRect
impl IntRect
sourcepub fn from_xywh(x: i32, y: i32, width: u32, height: u32) -> Option<IntRect>
pub fn from_xywh(x: i32, y: i32, width: u32, height: u32) -> Option<IntRect>
Creates a new IntRect
.
sourcepub fn from_ltrb(left: i32, top: i32, right: i32, bottom: i32) -> Option<IntRect>
pub fn from_ltrb(left: i32, top: i32, right: i32, bottom: i32) -> Option<IntRect>
Creates a new IntRect
.
sourcepub fn contains(&self, other: &IntRect) -> bool
pub fn contains(&self, other: &IntRect) -> bool
Checks that the rect is completely includes other
Rect.
sourcepub fn intersect(&self, other: &IntRect) -> Option<IntRect>
pub fn intersect(&self, other: &IntRect) -> Option<IntRect>
Returns an intersection of two rectangles.
Returns None
otherwise.