[][src]Struct nines::Style

pub struct Style {
    pub border: Rect<Scale>,
    pub center: Axises<Scale>,
}

The scaling style of a nine-square layout.

Corners, and the short axis of borders, are hardcoded against Scale::Stretch.

   ┈┬───────────┬┈
    │           │ 
   ┈┼───────────┼┈
    ┊           ┊

Will use the values:

axisdirectionvalue
xhorizontalborder.top
yverticalScale::Stretch
 ┌──┬┈
 │  │ 
 ├──┼┈
 ┊  ┊ 

Will use the values:

axisdirectionvalue
xhorizontalScale::Stretch
yverticalScale::Stretch

The center gets its own values:

    ┊           ┊
   ┈┼───────────┼┈
    │           │
    │           │
    │           │
   ┈┼───────────┼┈
    ┊           ┊

Will use the values:

axisdirectionvalue
xhorizontalcenter.horizontal
yverticalcenter.vertical

Fields

border: Rect<Scale>center: Axises<Scale>

Methods

impl Style[src]

pub const fn new(scale: Scale) -> Self[src]

Create a new style with the same scaling on all axises.

 ┊←→┊←─ scale ─→┊←→┊
 ┌──┬───────────┬──┐┈┈┈┈
 │  │           │  │   ↕
 ├──┼───────────┼──┤┈┈┈┈
 │  │           │  │   ↑
 │  │           │  │ scale
 │  │           │  │   ↓
 ├──┼───────────┼──┤┈┈┈┈
 │  │           │  │   ↕
 └──┴───────────┴──┘┈┈┈┈

pub const fn new_horizontal_vertical(horizontal: Scale, vertical: Scale) -> Self[src]

Create a new style with uniform scaling along each axis.

 ┊←→┊←horizontal→┊←→┊
 ┌──┬────────────┬──┐┈┈┈┈┈
 │  │            │  │    ↕
 ├──┼────────────┼──┤┈┈┈┈┈
 │  │            │  │    ↑
 │  │            │  │ vertical
 │  │            │  │    ↓
 ├──┼────────────┼──┤┈┈┈┈┈
 │  │            │  │    ↕
 └──┴────────────┴──┘┈┈┈┈┈

Trait Implementations

impl Clone for Style[src]

impl Copy for Style[src]

impl Default for Style[src]

impl Debug for Style[src]

Auto Trait Implementations

impl Send for Style

impl Sync for Style

impl Unpin for Style

impl UnwindSafe for Style

impl RefUnwindSafe for Style

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]