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.
sourcepub fn to_screen_int_rect(&self) -> Option<ScreenIntRect>
pub fn to_screen_int_rect(&self) -> Option<ScreenIntRect>
Trait Implementations§
source§impl PartialEq<IntRect> for IntRect
impl PartialEq<IntRect> for IntRect
impl Copy for IntRect
impl StructuralPartialEq for IntRect
Auto Trait Implementations§
impl RefUnwindSafe for IntRect
impl Send for IntRect
impl Sync for IntRect
impl Unpin for IntRect
impl UnwindSafe for IntRect
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