Struct tiny_skia::Rect[][src]

pub struct Rect { /* fields omitted */ }

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 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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.