pub enum VariableBinding<'f> {
Value((ValueType, Value)),
Provider(Function<'f>),
}Expand description
Variable binding: value or provider.
VariableBinding represents a runtime variable binding, which can be:
- Value binding (
Value): Directly stored variable value - Provider binding (
Provider): Dynamically computed variable value through functions
§Lifetime Parameters
'f: Lifetime of provider functions
Variants§
Value((ValueType, Value))
Directly stored value binding, containing (type, value) tuple
Provider(Function<'f>)
Dynamic provider binding, computing values through functions
Implementations§
Source§impl<'f> VariableBinding<'f>
impl<'f> VariableBinding<'f>
Sourcepub fn from_value<T: IntoValue + TypedValue>(value: T) -> Self
pub fn from_value<T: IntoValue + TypedValue>(value: T) -> Self
Sourcepub fn from_provider<F, Fm>(provider: F) -> Selfwhere
F: IntoFunction<'f, Fm>,
Fm: FnMarker,
pub fn from_provider<F, Fm>(provider: F) -> Selfwhere
F: IntoFunction<'f, Fm>,
Fm: FnMarker,
Sourcepub fn value_type(&self) -> ValueType
pub fn value_type(&self) -> ValueType
Sourcepub fn is_value(&self) -> bool
pub fn is_value(&self) -> bool
Returns whether this is a value binding.
§Returns
true if this is a Value binding, false if it’s a Provider binding
Sourcepub fn is_provider(&self) -> bool
pub fn is_provider(&self) -> bool
Returns whether this is a provider binding.
§Returns
true if this is a Provider binding, false if it’s a Value binding
Sourcepub fn as_value(&self) -> Option<&Value>
pub fn as_value(&self) -> Option<&Value>
Returns the value if this is a value binding.
§Returns
Some(&Value) if this is a value binding, None if it’s a provider binding
Sourcepub fn as_provider(&self) -> Option<&Function<'f>>
pub fn as_provider(&self) -> Option<&Function<'f>>
Returns the provider function if this is a provider binding.
§Returns
Some(&Function) if this is a provider binding, None if it’s a value binding
Sourcepub fn into_value(self) -> Option<Value>
pub fn into_value(self) -> Option<Value>
Converts this binding into a value if it’s a value binding.
§Returns
Some(Value) if this is a value binding, None if it’s a provider binding
Sourcepub fn into_provider(self) -> Option<Function<'f>>
pub fn into_provider(self) -> Option<Function<'f>>
Converts this binding into a provider function if it’s a provider binding.
§Returns
Some(Function) if this is a provider binding, None if it’s a value binding
Trait Implementations§
Source§impl<'f> Clone for VariableBinding<'f>
impl<'f> Clone for VariableBinding<'f>
Source§fn clone(&self) -> VariableBinding<'f>
fn clone(&self) -> VariableBinding<'f>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'f> Freeze for VariableBinding<'f>
impl<'f> !RefUnwindSafe for VariableBinding<'f>
impl<'f> Send for VariableBinding<'f>
impl<'f> Sync for VariableBinding<'f>
impl<'f> Unpin for VariableBinding<'f>
impl<'f> !UnwindSafe for VariableBinding<'f>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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