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). Constraints 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§fn from(value: f32) -> AvailableSpace
fn from(value: f32) -> AvailableSpace
Source§impl FromLength for AvailableSpace
impl FromLength for AvailableSpace
Source§fn from_length<Input>(value: Input) -> AvailableSpace
fn from_length<Input>(value: Input) -> AvailableSpace
Into<f32>
into SelfSource§impl MaybeMath<Option<f32>, AvailableSpace> for AvailableSpace
impl MaybeMath<Option<f32>, AvailableSpace> for AvailableSpace
Source§fn maybe_clamp(self, min: Option<f32>, max: Option<f32>) -> AvailableSpace
fn maybe_clamp(self, min: Option<f32>, max: Option<f32>) -> AvailableSpace
self
clamped between min
and max
Source§impl MaybeMath<f32, AvailableSpace> for AvailableSpace
impl MaybeMath<f32, AvailableSpace> for AvailableSpace
Source§fn maybe_min(self, rhs: f32) -> AvailableSpace
fn maybe_min(self, rhs: f32) -> AvailableSpace
self
and rhs
Source§fn maybe_max(self, rhs: f32) -> AvailableSpace
fn maybe_max(self, rhs: f32) -> AvailableSpace
self
and rhs
Source§fn maybe_clamp(self, min: f32, max: f32) -> AvailableSpace
fn maybe_clamp(self, min: f32, max: f32) -> AvailableSpace
self
clamped between min
and max
Source§fn maybe_add(self, rhs: f32) -> AvailableSpace
fn maybe_add(self, rhs: f32) -> AvailableSpace
self
and rhs
.Source§impl PartialEq for AvailableSpace
impl PartialEq for AvailableSpace
Source§impl TaffyMaxContent for AvailableSpace
impl TaffyMaxContent for AvailableSpace
Source§const MAX_CONTENT: AvailableSpace = Self::MaxContent
const MAX_CONTENT: AvailableSpace = Self::MaxContent
Source§impl TaffyMinContent for AvailableSpace
impl TaffyMinContent for AvailableSpace
Source§const MIN_CONTENT: AvailableSpace = Self::MinContent
const MIN_CONTENT: AvailableSpace = Self::MinContent
Source§impl TaffyZero for AvailableSpace
impl TaffyZero for AvailableSpace
Source§const ZERO: AvailableSpace = _
const ZERO: 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, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more