[−][src]Struct tiny_skia::Rect
A rectangle defined by left, top, right and bottom edges.
Can have zero width and/or height. But not a negative one.
Guarantees
- All values are finite.
- Left edge is <= right.
- Top edge is <= bottom.
- Width and height are <= f32::MAX.
Implementations
impl Rect
[src]
pub fn from_ltrb(left: f32, top: f32, right: f32, bottom: f32) -> Option<Self>
[src]
Creates new Rect
.
pub fn from_xywh(x: f32, y: f32, w: f32, h: f32) -> Option<Self>
[src]
Creates new Rect
.
pub const unsafe fn from_ltrb_unchecked(
left: f32,
top: f32,
right: f32,
bottom: f32
) -> Self
[src]
left: f32,
top: f32,
right: f32,
bottom: f32
) -> Self
pub fn left(&self) -> f32
[src]
Returns the left edge.
pub fn top(&self) -> f32
[src]
Returns the top edge.
pub fn right(&self) -> f32
[src]
Returns the right edge.
pub fn bottom(&self) -> f32
[src]
Returns the bottom edge.
pub fn x(&self) -> f32
[src]
Returns rect's X position.
pub fn y(&self) -> f32
[src]
Returns rect's Y position.
pub fn width(&self) -> f32
[src]
Returns rect's width.
pub fn height(&self) -> f32
[src]
Returns rect's height.
pub fn round(&self) -> IntRect
[src]
Converts into an IntRect
by adding 0.5 and discarding the fractional portion.
Width and height are guarantee to be >= 1.
Trait Implementations
impl Clone for Rect
[src]
impl Copy for Rect
[src]
impl Debug for Rect
[src]
impl PartialEq<Rect> for Rect
[src]
impl StructuralPartialEq for Rect
[src]
Auto Trait Implementations
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnwindSafe for Rect
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,