[][src]Struct druid::BoxConstraints

pub struct BoxConstraints { /* fields omitted */ }

Constraints for layout.

The layout strategy for druid is strongly inspired by Flutter, and this struct is similar to the Flutter BoxConstraints class.

At the moment, it represents simply a minimum and maximum size. A widget's layout method should choose an appropriate size that meets these constraints.

Further, a container widget should compute appropriate constraints for each of its child widgets, and pass those down when recursing.

Methods

impl BoxConstraints[src]

pub fn new(min: Size, max: Size) -> BoxConstraints[src]

Create a new box constraints object.

Create constraints based on minimum and maximum size.

pub fn tight(size: Size) -> BoxConstraints[src]

Create a "tight" box constraints object.

A "tight" constraint can only be satisfied by a single size.

pub fn loosen(&self) -> BoxConstraints[src]

Create a "loose" version of the constraints.

Make a version with zero minimum size, but the same maximum size.

pub fn constrain(&self, size: impl Into<Size>) -> Size[src]

Clamp a given size so that fits within the constraints.

pub fn max(&self) -> Size[src]

Returns the max size of these constraints.

pub fn min(&self) -> Size[src]

Returns the min size of these constraints.

pub fn is_width_bounded(&self) -> bool[src]

Whether there is an upper bound on the width.

pub fn is_height_bounded(&self) -> bool[src]

Whether there is an upper bound on the height.

pub fn debug_check(&self, name: &str)[src]

Check to see if these constraints are legit.

Logs a warning if BoxConstraints are invalid.

Trait Implementations

impl Clone for BoxConstraints[src]

impl Copy for BoxConstraints[src]

impl Debug for BoxConstraints[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for 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.

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]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>,