Skip to main content

Min

Struct Min 

Source
pub struct Min(/* private fields */);
Expand description

A lower clamp on one axis: a number of logical px, or the node’s own fit size on that axis (Min::FIT, minWidth: "fit" in the bindings). FIT is what lets a Grow child keep a content floor, like CSS’s flex: 1 0 auto: tabs split a bar evenly while they fit and sit at their label’s width, scrolling, once they do not. Layout resolves it to a number in the fit pass of its axis, so every later clamp reads one; until then it clamps like no floor at all.

Undeclared is Min::AUTO, which clamps as 0 everywhere but one place: a child giving in an overflowing row that holds a share of the room, where it is CSS’s min-width: auto, the child’s min-content. A declared 0 (Min::px(0.0)) is no floor there either, as CSS’s min-width: 0 is how a flex item is let go below its content.

Stored as one f32 with FIT and a calc as negatives (the form the C struct’s min_w takes too), because LayoutSpec is copied per node per frame.

Implementations§

Source§

impl Min

Source

pub const FIT: Min

The node’s own fit size on this axis.

Source

pub const AUTO: Min

No floor declared: the node’s min-content where a share of the room gives in CSS’s way and down a column of fit children; 0 across a run of fit children alone, across a column, where a fit node is held to the column’s box, and for a node that scrolls or clips. Negative zero, so it is 0 to every clamp and to ==, and told apart from a declared 0 by its sign alone (Min::is_auto).

Source

pub fn px(v: f32) -> Min

A floor of v logical px; a negative (or NaN) is a floor of 0, declared — no automatic one either.

Source

pub fn is_auto(self) -> bool

Whether no floor was declared (Min::AUTO).

Source

pub fn is_fit(self) -> bool

Whether this is the unresolved fit floor.

Source

pub fn calc(c: Calc) -> Min

A floor that is a size expression, until layout resolves it: -2 minus its number, below FIT’s -1.

Source

pub fn as_calc(self) -> Option<Calc>

The size expression this floor waits on, if it is one.

Source

pub fn resolved(self) -> f32

The clamp as a number: the px it holds, or 0 for a FIT or a calc layout has not resolved yet (nothing to floor at).

Trait Implementations§

Source§

impl Clone for Min

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Min

Source§

impl Debug for Min

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Min

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Min> for Bound

Source§

fn from(m: Min) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Min

Source§

fn from(v: f32) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Min

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Min

Auto Trait Implementations§

§

impl Freeze for Min

§

impl RefUnwindSafe for Min

§

impl Send for Min

§

impl Sync for Min

§

impl Unpin for Min

§

impl UnsafeUnpin for Min

§

impl UnwindSafe for Min

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.