Enum taffy::style::AvailableSpace
source · pub enum AvailableSpace {
Definite(f32),
MinContent,
MaxContent,
}
Expand description
The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
Variants§
Definite(f32)
The amount of space available is the specified number of pixels
MinContent
The amount of space available is indefinite and the node should be laid out under a min-content constraint
MaxContent
The amount of space available is indefinite and the node should be laid out under a max-content constraint
Implementations§
source§impl AvailableSpace
impl AvailableSpace
sourcepub fn is_definite(self) -> bool
pub fn is_definite(self) -> bool
Returns true for definite values, else false
sourcepub fn into_option(self) -> Option<f32>
pub fn into_option(self) -> Option<f32>
Convert to Option Definite values become Some(value). Contraints become None.
sourcepub fn or(self, default: AvailableSpace) -> AvailableSpace
pub fn or(self, default: AvailableSpace) -> AvailableSpace
Return self if definite or a default value
sourcepub fn or_else(
self,
default_cb: impl FnOnce() -> AvailableSpace,
) -> AvailableSpace
pub fn or_else( self, default_cb: impl FnOnce() -> AvailableSpace, ) -> AvailableSpace
Return self if definite or a the result of the default value callback
sourcepub fn unwrap_or_else(self, default_cb: impl FnOnce() -> f32) -> f32
pub fn unwrap_or_else(self, default_cb: impl FnOnce() -> f32) -> f32
Return the definite value or the result of the default value callback
sourcepub fn maybe_set(self, value: Option<f32>) -> AvailableSpace
pub fn maybe_set(self, value: Option<f32>) -> AvailableSpace
If passed value is Some then return AvailableSpace::Definite containing that value, else return self
sourcepub fn map_definite_value(
self,
map_function: impl FnOnce(f32) -> f32,
) -> AvailableSpace
pub fn map_definite_value( self, map_function: impl FnOnce(f32) -> f32, ) -> AvailableSpace
If passed value is Some then return AvailableSpace::Definite containing that value, else return self
sourcepub fn compute_free_space(&self, used_space: f32) -> f32
pub fn compute_free_space(&self, used_space: f32) -> f32
Compute free_space given the passed used_space
sourcepub fn is_roughly_equal(self, other: AvailableSpace) -> bool
pub fn is_roughly_equal(self, other: AvailableSpace) -> bool
Compare equality with another AvailableSpace, treating definite values that are within f32::EPSILON of each other as equal
Trait Implementations§
source§impl Clone for AvailableSpace
impl Clone for AvailableSpace
source§fn clone(&self) -> AvailableSpace
fn clone(&self) -> AvailableSpace
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AvailableSpace
impl Debug for AvailableSpace
source§impl From<f32> for AvailableSpace
impl From<f32> for AvailableSpace
source§impl FromLength for AvailableSpace
impl FromLength for AvailableSpace
source§impl PartialEq for AvailableSpace
impl PartialEq for AvailableSpace
source§impl TaffyMaxContent for AvailableSpace
impl TaffyMaxContent for AvailableSpace
source§const MAX_CONTENT: Self = Self::MaxContent
const MAX_CONTENT: Self = Self::MaxContent
source§impl TaffyMinContent for AvailableSpace
impl TaffyMinContent for AvailableSpace
source§const MIN_CONTENT: Self = Self::MinContent
const MIN_CONTENT: Self = Self::MinContent
source§impl TaffyZero for AvailableSpace
impl TaffyZero for AvailableSpace
impl Copy for AvailableSpace
impl StructuralPartialEq for AvailableSpace
Auto Trait Implementations§
impl Freeze for AvailableSpace
impl RefUnwindSafe for AvailableSpace
impl Send for AvailableSpace
impl Sync for AvailableSpace
impl Unpin for AvailableSpace
impl UnwindSafe for AvailableSpace
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)