Struct tiny_skia::geom::ScreenIntRect
source · pub struct ScreenIntRect {
x: u32,
y: u32,
width: NonZeroU32,
height: NonZeroU32,
}
Expand description
A screen IntRect
.
§Guarantees
- X and Y are in 0..=i32::MAX range.
- Width and height are in 1..=i32::MAX range.
- x+width and y+height does not overflow.
Fields§
§x: u32
§y: u32
§width: NonZeroU32
§height: NonZeroU32
Implementations§
source§impl ScreenIntRect
impl ScreenIntRect
sourcepub fn from_xywh(x: u32, y: u32, width: u32, height: u32) -> Option<Self>
pub fn from_xywh(x: u32, y: u32, width: u32, height: u32) -> Option<Self>
Creates a new ScreenIntRect
.
sourcepub const fn from_xywh_safe(
x: u32,
y: u32,
width: NonZeroU32,
height: NonZeroU32,
) -> Self
pub const fn from_xywh_safe( x: u32, y: u32, width: NonZeroU32, height: NonZeroU32, ) -> Self
Creates a new ScreenIntRect
.
sourcepub fn width_safe(&self) -> NonZeroU32
pub fn width_safe(&self) -> NonZeroU32
Returns rect’s width.
sourcepub fn contains(&self, other: &Self) -> bool
pub fn contains(&self, other: &Self) -> bool
Checks that the rect is completely includes other
Rect.
sourcepub fn to_int_rect(&self) -> IntRect
pub fn to_int_rect(&self) -> IntRect
Converts into a IntRect
.
Trait Implementations§
source§impl Clone for ScreenIntRect
impl Clone for ScreenIntRect
source§fn clone(&self) -> ScreenIntRect
fn clone(&self) -> ScreenIntRect
Returns a copy 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 ScreenIntRect
impl Debug for ScreenIntRect
source§impl PartialEq for ScreenIntRect
impl PartialEq for ScreenIntRect
impl Copy for ScreenIntRect
impl StructuralPartialEq for ScreenIntRect
Auto Trait Implementations§
impl Freeze for ScreenIntRect
impl RefUnwindSafe for ScreenIntRect
impl Send for ScreenIntRect
impl Sync for ScreenIntRect
impl Unpin for ScreenIntRect
impl UnwindSafe for ScreenIntRect
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)