[][src]Struct unsegen::widget::widget::Demand

pub struct Demand<T: AxisDimension> {
    pub min: PositiveAxisDiff<T>,
    pub max: Option<PositiveAxisDiff<T>>,
    // some fields omitted
}

A one dimensional description of spatial demand of a widget.

A Demand always has a minimum (although it may be zero) and may have a maximum. It is required that the minimum is smaller or equal to the maximum (if present).

Fields

min: PositiveAxisDiff<T>max: Option<PositiveAxisDiff<T>>

Implementations

impl<T: AxisDimension + PartialOrd + Ord> Demand<T>[src]

pub fn zero() -> Self[src]

A minimum and maximum demand of exactly 0.

pub fn exact<I: Into<PositiveAxisDiff<T>> + Copy>(size: I) -> Self[src]

A minimum and maximum demand of exactly the specified amount.

pub fn at_least<I: Into<PositiveAxisDiff<T>> + Copy>(size: I) -> Self[src]

An specified minimum demand, but no defined maximum.

pub fn from_to<I: Into<PositiveAxisDiff<T>> + Copy>(min: I, max: I) -> Self[src]

A specified range of acceptable values between minimum and maximum.

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

Compute the composed maximum of two Demands. This is especially useful when building tables for example.

Examples:

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

let d1 = Demand::<ColDimension>::exact(5);
let d2 = Demand::<ColDimension>::at_least(0);

assert_eq!(d1.max(d2), Demand::<ColDimension>::at_least(5));

pub fn max_assign(&mut self, other: Self)[src]

Replace self with the maximum of self and other (see Demand::max).

Trait Implementations

impl<T: AxisDimension> Add<Demand<T>> for Demand<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: AxisDimension> AddAssign<Demand<T>> for Demand<T>[src]

impl<T: Clone + AxisDimension> Clone for Demand<T>[src]

impl<T: Copy + AxisDimension> Copy for Demand<T>[src]

impl<T: Debug + AxisDimension> Debug for Demand<T>[src]

impl<T: Eq + AxisDimension> Eq for Demand<T>[src]

impl<T: PartialEq + AxisDimension> PartialEq<Demand<T>> for Demand<T>[src]

impl<T: PartialOrd + AxisDimension> PartialOrd<Demand<T>> for Demand<T>[src]

impl<T: AxisDimension> StructuralEq for Demand<T>[src]

impl<T: AxisDimension> StructuralPartialEq for Demand<T>[src]

impl<'a, T: AxisDimension + PartialOrd + Ord> Sum<&'a Demand<T>> for Demand<T>[src]

impl<T: AxisDimension + PartialOrd + Ord> Sum<Demand<T>> for Demand<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Demand<T> where
    T: RefUnwindSafe

impl<T> Send for Demand<T> where
    T: Send

impl<T> Sync for Demand<T> where
    T: Sync

impl<T> Unpin for Demand<T> where
    T: Unpin

impl<T> UnwindSafe for Demand<T> where
    T: UnwindSafe

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.