pub struct AnyWhenVarBuilder { /* private fields */ }Expand description
Type erased when_var! manual builder.
See WhenVarBuilder for more details.
Implementations§
Source§impl AnyWhenVarBuilder
impl AnyWhenVarBuilder
Sourcepub fn new(default: AnyVar) -> Self
pub fn new(default: AnyVar) -> Self
New with value variable used when no other conditions are true.
Sourcepub fn push(&mut self, condition: Var<bool>, value: AnyVar) -> &mut Self
pub fn push(&mut self, condition: Var<bool>, value: AnyVar) -> &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 replace_extend(&mut self, other: &Self)
pub fn replace_extend(&mut self, other: &Self)
Replace the default value if other has default and extend the conditions with clones of other.
Sourcepub fn build(self, value_type: TypeId) -> AnyVar
pub fn build(self, value_type: TypeId) -> AnyVar
Build the when var.
The value_type is the when var output value type.
Sourcepub fn into_typed<O: VarValue>(self) -> WhenVarBuilder<O>
pub fn into_typed<O: VarValue>(self) -> WhenVarBuilder<O>
Convert to typed builder.
Note that the type is not checked.
Sourcepub fn try_from_built(var: &AnyVar) -> Option<Self>
pub fn try_from_built(var: &AnyVar) -> Option<Self>
If the var was built by build clones the internal conditions, values and default variables into a new builder.
Source§impl AnyWhenVarBuilder
impl AnyWhenVarBuilder
Sourcepub fn condition_count(&self) -> usize
pub fn condition_count(&self) -> usize
Returns the number of conditions set.
Trait Implementations§
Source§impl Clone for AnyWhenVarBuilder
impl Clone for AnyWhenVarBuilder
Source§fn clone(&self) -> AnyWhenVarBuilder
fn clone(&self) -> AnyWhenVarBuilder
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 !Freeze for AnyWhenVarBuilder
impl !RefUnwindSafe for AnyWhenVarBuilder
impl Send for AnyWhenVarBuilder
impl Sync for AnyWhenVarBuilder
impl !Unpin for AnyWhenVarBuilder
impl !UnwindSafe for AnyWhenVarBuilder
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