[][src]Struct nines::Rect

pub struct Rect<V: Debug> {
    pub left: V,
    pub right: V,
    pub top: V,
    pub bottom: V,
}

A rectangle. See also ValidRect. Generally not inclusive of the right/bottom edge.

Fields

left: Vright: Vtop: Vbottom: V

Methods

impl<S: Scalar> Rect<S>[src]

#[must_use] pub fn xywh(x: S, y: S, w: S, h: S) -> Self[src]

#[must_use] pub fn grow(&self, borders: &Self) -> Self[src]

#[must_use] pub fn shrink(&self, borders: &Self) -> Self[src]

#[must_use] pub fn validate(&self) -> Result<ValidRect<S>, Error>[src]

Validate this rectangle has non-negative / non-NaN dimensions. This means:

left ≤ right
top ≤ bottom

Trait Implementations

impl<S: Scalar> From<Range<[S; 2]>> for Rect<S>[src]

impl<S: Scalar> From<[Range<S>; 2]> for Rect<S>[src]

impl<S: Scalar> From<Range<(S, S)>> for Rect<S>[src]

impl<S: Scalar> From<(Range<S>, Range<S>)> for Rect<S>[src]

impl<V: Clone + Debug> Clone for Rect<V>[src]

impl<V: Copy + Debug> Copy for Rect<V>[src]

impl<V: Default + Debug> Default for Rect<V>[src]

impl<S: Scalar> PartialEq<Rect<S>> for ValidRect<S>[src]

impl<S: Scalar> PartialEq<ValidRect<S>> for Rect<S>[src]

impl<V: PartialEq + Debug> PartialEq<Rect<V>> for Rect<V>[src]

impl<V: Debug> Debug for Rect<V>[src]

impl<S: Scalar> TryFrom<Rect<S>> for ValidRect<S>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_, S: Scalar> TryFrom<&'_ Rect<S>> for ValidRect<S>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<V: Debug> StructuralPartialEq for Rect<V>[src]

Auto Trait Implementations

impl<V> Send for Rect<V> where
    V: Send

impl<V> Sync for Rect<V> where
    V: Sync

impl<V> Unpin for Rect<V> where
    V: Unpin

impl<V> UnwindSafe for Rect<V> where
    V: UnwindSafe

impl<V> RefUnwindSafe for Rect<V> where
    V: RefUnwindSafe

Blanket Implementations

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 = !

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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