pub struct WhenVarBuilder<O: VarValue> { /* private fields */ }Expand description
Manual when_var! builder.
Implementations§
Source§impl<O: VarValue> WhenVarBuilder<O>
impl<O: VarValue> WhenVarBuilder<O>
Sourcepub fn new(default: impl IntoVar<O>) -> Self
pub fn new(default: impl IntoVar<O>) -> Self
New with value variable used when no other conditions are true.
Sourcepub fn push(
&mut self,
condition: impl IntoVar<bool>,
value: impl IntoVar<O>,
) -> &mut Self
pub fn push( &mut self, condition: impl IntoVar<bool>, value: impl IntoVar<O>, ) -> &mut Self
Push a conditional value.
When the condition is true and all previous pushed conditions
are false the when variable represents the value variable.
Sourcepub fn as_any(&mut self) -> &mut AnyWhenVarBuilder
pub fn as_any(&mut self) -> &mut AnyWhenVarBuilder
Reference the type erased when builder.
Sourcepub fn try_from_built(var: &Var<O>) -> Option<Self>
pub fn try_from_built(var: &Var<O>) -> Option<Self>
If the var was built by build clones the internal conditions, values and default variables into a new builder.
Source§impl<O: VarValue + Transitionable> WhenVarBuilder<O>
impl<O: VarValue + Transitionable> WhenVarBuilder<O>
Sourcepub fn build_easing(
self,
condition_easing: Vec<Option<(Duration, Arc<dyn Fn(EasingTime) -> EasingStep + Send + Sync>)>>,
default_easing: (Duration, Arc<dyn Fn(EasingTime) -> EasingStep + Send + Sync>),
) -> Var<O>
pub fn build_easing( self, condition_easing: Vec<Option<(Duration, Arc<dyn Fn(EasingTime) -> EasingStep + Send + Sync>)>>, default_easing: (Duration, Arc<dyn Fn(EasingTime) -> EasingStep + Send + Sync>), ) -> Var<O>
Build a variable similar to Var::easing, but with different duration and easing functions for each condition.
The condition_easing must contain one entry for each when condition, entries can be None, the easing used
is the first entry that corresponds to a true condition, or falls back to the default_easing.
Trait Implementations§
Source§impl<O: Clone + VarValue> Clone for WhenVarBuilder<O>
impl<O: Clone + VarValue> Clone for WhenVarBuilder<O>
Source§fn clone(&self) -> WhenVarBuilder<O>
fn clone(&self) -> WhenVarBuilder<O>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<O> !Freeze for WhenVarBuilder<O>
impl<O> !RefUnwindSafe for WhenVarBuilder<O>
impl<O> Send for WhenVarBuilder<O>
impl<O> Sync for WhenVarBuilder<O>
impl<O> !Unpin for WhenVarBuilder<O>
impl<O> !UnwindSafe for WhenVarBuilder<O>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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