Enum bevy::ui::measurement::AvailableSpace
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§
§impl AvailableSpace
impl AvailableSpace
pub fn is_definite(self) -> bool
pub fn is_definite(self) -> bool
Returns true for definite values, else false
pub fn into_option(self) -> Option<f32>
pub fn into_option(self) -> Option<f32>
Convert to Option Definite values become Some(value). Contraints become None.
pub fn or(self, default: AvailableSpace) -> AvailableSpace
pub fn or(self, default: AvailableSpace) -> AvailableSpace
Return self if definite or a default value
pub 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
pub 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
pub 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
pub 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
pub 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
pub 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§
§impl Clone for AvailableSpace
impl Clone for AvailableSpace
§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 more§impl Debug for AvailableSpace
impl Debug for AvailableSpace
§impl From<Option<f32>> for AvailableSpace
impl From<Option<f32>> for AvailableSpace
§fn from(option: Option<f32>) -> AvailableSpace
fn from(option: Option<f32>) -> AvailableSpace
§impl From<f32> for AvailableSpace
impl From<f32> for AvailableSpace
§fn from(value: f32) -> AvailableSpace
fn from(value: f32) -> AvailableSpace
§impl FromPoints for AvailableSpace
impl FromPoints for AvailableSpace
§fn from_points<Input>(points: Input) -> AvailableSpacewhere
Input: Into<f32> + Copy,
fn from_points<Input>(points: Input) -> AvailableSpacewhere Input: Into<f32> + Copy,
Into<f32>
into Self§impl PartialEq<AvailableSpace> for AvailableSpace
impl PartialEq<AvailableSpace> for AvailableSpace
§fn eq(&self, other: &AvailableSpace) -> bool
fn eq(&self, other: &AvailableSpace) -> bool
self
and other
values to be equal, and is used
by ==
.§impl TaffyMaxContent for AvailableSpace
impl TaffyMaxContent for AvailableSpace
§const MAX_CONTENT: AvailableSpace = Self::MaxContent
const MAX_CONTENT: AvailableSpace = Self::MaxContent
§impl TaffyMinContent for AvailableSpace
impl TaffyMinContent for AvailableSpace
§const MIN_CONTENT: AvailableSpace = Self::MinContent
const MIN_CONTENT: AvailableSpace = Self::MinContent
§impl TaffyZero for AvailableSpace
impl TaffyZero for AvailableSpace
§const ZERO: AvailableSpace = _
const ZERO: AvailableSpace = _
impl Copy for AvailableSpace
impl StructuralPartialEq for AvailableSpace
Auto Trait Implementations§
impl RefUnwindSafe for AvailableSpace
impl Send for AvailableSpace
impl Sync for AvailableSpace
impl Unpin for AvailableSpace
impl UnwindSafe for AvailableSpace
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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
.§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§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.§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.