[][src]Struct nines::Dimensions

pub struct Dimensions<S: Scalar> {
    pub outer: Rect<S>,
    pub inner: Rect<S>,
}

The dimensions of a nine-square layout. See also ValidDimensions.

left             right   ┌──→ +x
 ┊←──── outer ────→┊     │
 ┊                 ┊     ↓
 ┊  ┊←─ inner ─→┊  ┊    + y
 ┊  ┊           ┊  ┊
 ┌──┬───────────┬──┐┈┈┈┈┈┈┈┈ top
 │  │           │  │          ↑
 ├──┼───────────┼──┤┈┈┈┈      │
 │  │           │  │   ↑      │
 │  │           │  │ inner  outer
 │  │           │  │   ↓      │
 ├──┼───────────┼──┤┈┈┈┈      │
 │  │           │  │          ↓
 └──┴───────────┴──┘┈┈┈┈┈┈ bottom

Fields

outer: Rect<S>inner: Rect<S>

Methods

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

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

Validate these dimensions are non-negative / non-NaN. This means:

outer.left ≤ inner.left ≤ inner.right ≤ outer.right
outer.top ≤ inner.top ≤ inner.bottom ≤ outer.bottom

Trait Implementations

impl<S: Clone + Scalar> Clone for Dimensions<S>[src]

impl<S: Copy + Scalar> Copy for Dimensions<S>[src]

impl<S: Default + Scalar> Default for Dimensions<S>[src]

impl<S: Scalar> PartialEq<Dimensions<S>> for ValidDimensions<S>[src]

impl<S: Scalar> PartialEq<ValidDimensions<S>> for Dimensions<S>[src]

impl<S: PartialEq + Scalar> PartialEq<Dimensions<S>> for Dimensions<S>[src]

impl<S: Debug + Scalar> Debug for Dimensions<S>[src]

impl<S: Scalar> TryFrom<Dimensions<S>> for ValidDimensions<S>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<'_, S: Scalar> TryFrom<&'_ Dimensions<S>> for ValidDimensions<S>[src]

type Error = Error

The type returned in the event of a conversion error.

impl<S: Scalar> StructuralPartialEq for Dimensions<S>[src]

Auto Trait Implementations

impl<S> Send for Dimensions<S> where
    S: Send

impl<S> Sync for Dimensions<S> where
    S: Sync

impl<S> Unpin for Dimensions<S> where
    S: Unpin

impl<S> UnwindSafe for Dimensions<S> where
    S: UnwindSafe

impl<S> RefUnwindSafe for Dimensions<S> where
    S: 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]