Skip to main content

ResolveOrZero

Trait ResolveOrZero 

pub trait ResolveOrZero<TContext, TOutput>
where TOutput: TaffyZero,
{ // Required method fn resolve_or_zero( self, context: TContext, calc: impl Fn(*const (), f32) -> f32, ) -> TOutput; }
Expand description

Trait to encapsulate behaviour where we need to resolve from a potentially context-dependent size or dimension into a context-independent size or dimension.

Will return a default value if it unable to resolve.

Required Methods§

fn resolve_or_zero( self, context: TContext, calc: impl Fn(*const (), f32) -> f32, ) -> TOutput

Resolve a dimension that might be dependent on a context, with a default fallback value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl ResolveOrZero<Option<f32>, f32> for Dimension

§

impl ResolveOrZero<Option<f32>, f32> for LengthPercentage

§

impl ResolveOrZero<Option<f32>, f32> for LengthPercentageAuto

§

impl<In, Out, T> ResolveOrZero<Size<In>, Rect<Out>> for Rect<T>
where In: Copy, Out: TaffyZero, T: ResolveOrZero<In, Out>,

§

impl<In, Out, T> ResolveOrZero<Size<In>, Size<Out>> for Size<T>
where Out: TaffyZero, T: ResolveOrZero<In, Out>,

§

impl<Out, T> ResolveOrZero<Option<f32>, Rect<Out>> for Rect<T>
where Out: TaffyZero, T: ResolveOrZero<Option<f32>, Out>,