[][src]Struct unsegen::widget::widget::Demand2D

pub struct Demand2D {
    pub width: ColDemand,
    pub height: RowDemand,
}

A two dimensional (rectangular) Demand (composed of Demands for columns and rows).

Fields

width: ColDemandheight: RowDemand

Implementations

impl Demand2D[src]

pub fn add_vertical(self, other: Self) -> Self[src]

Combine two Demand2Ds by accumulating the height and making the width accommodate both.

This is useful two compute the combined Demand2D of two widgets arranged on top of each other.

Examples:

use unsegen::base::*;
use unsegen::widget::*;

let d1 = Demand2D {
    width: ColDemand::exact(5),
    height: RowDemand::exact(5),
};
let d2 = Demand2D {
    width: ColDemand::at_least(2),
    height: RowDemand::from_to(3, 5),
};

assert_eq!(
    d1.add_vertical(d2),
    Demand2D {
        width: ColDemand::at_least(5),
        height: RowDemand::from_to(8, 10),
    }
);

pub fn add_horizontal(self, other: Self) -> Self[src]

Combine two Demand2Ds by accumulating the width and making the height accommodate both.

This is useful two compute the combined Demand2D of two widgets arranged on top of each other.

Examples:

use unsegen::base::*;
use unsegen::widget::*;

let d1 = Demand2D {
    width: ColDemand::exact(5),
    height: RowDemand::exact(5),
};
let d2 = Demand2D {
    width: ColDemand::at_least(2),
    height: RowDemand::from_to(3, 5),
};

assert_eq!(
    d1.add_horizontal(d2),
    Demand2D {
        width: ColDemand::at_least(7),
        height: RowDemand::exact(5),
    }
);

Trait Implementations

impl Clone for Demand2D[src]

impl Copy for Demand2D[src]

impl Debug for Demand2D[src]

impl Eq for Demand2D[src]

impl PartialEq<Demand2D> for Demand2D[src]

impl StructuralEq for Demand2D[src]

impl StructuralPartialEq for Demand2D[src]

Auto Trait Implementations

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.