[][src]Struct usvg::Rect

pub struct Rect { /* fields omitted */ }

A rect representation.

Width and height are guarantee to be > 0.

Methods

impl Rect[src]

pub fn new(x: f64, y: f64, width: f64, height: f64) -> Option<Self>[src]

Creates a new Rect from values.

pub fn new_bbox() -> Self[src]

Creates a new Rect for bounding box calculation.

Shorthand for Rect::new(f64::MAX, f64::MAX, 1.0, 1.0).

pub fn size(&self) -> Size[src]

Returns rect's size.

pub fn x(&self) -> f64[src]

Returns rect's X position.

pub fn y(&self) -> f64[src]

Returns rect's Y position.

pub fn width(&self) -> f64[src]

Returns rect's width.

pub fn height(&self) -> f64[src]

Returns rect's height.

pub fn left(&self) -> f64[src]

Returns rect's left edge position.

pub fn right(&self) -> f64[src]

Returns rect's right edge position.

pub fn top(&self) -> f64[src]

Returns rect's top edge position.

pub fn bottom(&self) -> f64[src]

Returns rect's bottom edge position.

pub fn translate(&self, tx: f64, ty: f64) -> Self[src]

Translates the rect by the specified offset.

pub fn translate_to(&self, x: f64, y: f64) -> Self[src]

Translates the rect to the specified position.

pub fn contains(&self, x: f64, y: f64) -> bool[src]

Checks that the rect contains a point.

pub fn expand(&self, r: Rect) -> Self[src]

Expands the Rect to the provided size.

Trait Implementations

impl Clone for Rect[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Copy for Rect[src]

impl Debug for Rect[src]

impl Display for Rect[src]

impl FuzzyEq<Rect> for Rect[src]

fn fuzzy_ne(&self, other: &Rhs) -> bool[src]

Returns true if values are not approximately equal.

Auto Trait Implementations

impl Unpin for Rect

impl Send for Rect

impl Sync for Rect

impl RefUnwindSafe for Rect

impl UnwindSafe for Rect

Blanket Implementations

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]