Struct zng::var::AnyWhenVarBuilder
source · pub struct AnyWhenVarBuilder { /* private fields */ }
Expand description
Manually build a ArcWhenVar<T>
from type erased parts.
Implementations§
source§impl AnyWhenVarBuilder
impl AnyWhenVarBuilder
sourcepub fn new<O>(default: impl IntoVar<O>) -> AnyWhenVarBuilderwhere
O: VarValue,
pub fn new<O>(default: impl IntoVar<O>) -> AnyWhenVarBuilderwhere
O: VarValue,
Start building with only the default value.
sourcepub fn new_any(default: Box<dyn AnyVar>) -> AnyWhenVarBuilder
pub fn new_any(default: Box<dyn AnyVar>) -> AnyWhenVarBuilder
Start building with already boxed var.
sourcepub fn from_var<O>(var: &ContextualizedVar<O>) -> AnyWhenVarBuilderwhere
O: VarValue,
pub fn from_var<O>(var: &ContextualizedVar<O>) -> AnyWhenVarBuilderwhere
O: VarValue,
sourcepub fn condition_count(&self) -> usize
pub fn condition_count(&self) -> usize
Returns the number of conditions set.
sourcepub fn set_default<O>(&mut self, default: impl IntoVar<O>)where
O: VarValue,
pub fn set_default<O>(&mut self, default: impl IntoVar<O>)where
O: VarValue,
Set/replace the default value.
sourcepub fn set_default_any(&mut self, default: Box<dyn AnyVar>)
pub fn set_default_any(&mut self, default: Box<dyn AnyVar>)
Set/replace the default value with an already typed erased var.
sourcepub fn push_any(
&mut self,
condition: Box<dyn VarBoxed<bool>>,
value: Box<dyn AnyVar>,
)
pub fn push_any( &mut self, condition: Box<dyn VarBoxed<bool>>, value: Box<dyn AnyVar>, )
Push a when condition already boxed and type erased.
sourcepub fn replace_extend(&mut self, other: &AnyWhenVarBuilder)
pub fn replace_extend(&mut self, other: &AnyWhenVarBuilder)
Replace the default value if other
has default and extend the conditions with clones of other
.
sourcepub fn extend(&mut self, other: &AnyWhenVarBuilder)
pub fn extend(&mut self, other: &AnyWhenVarBuilder)
Extend the conditions with clones of other
.
Trait Implementations§
source§impl Clone for AnyWhenVarBuilder
impl Clone for AnyWhenVarBuilder
source§fn clone(&self) -> AnyWhenVarBuilder
fn clone(&self) -> AnyWhenVarBuilder
Returns a copy 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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
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>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§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> 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>
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