pub enum Value<T> {
Literal(T),
Parameter(String),
Expression(String),
}Variants§
Literal(T)
A literal value known at parse time
Parameter(String)
A parameter reference that will be resolved at runtime
Expression(String)
A mathematical expression that will be evaluated at runtime
Implementations§
Source§impl<T> Value<T>
impl<T> Value<T>
Sourcepub fn resolve(&self, params: &HashMap<String, String>) -> Result<T>
pub fn resolve(&self, params: &HashMap<String, String>) -> Result<T>
Resolve this value using the provided parameter map
Sourcepub fn as_literal(&self) -> Option<&T>
pub fn as_literal(&self) -> Option<&T>
Get the literal value if this is a literal, otherwise None
Sourcepub fn as_parameter(&self) -> Option<&str>
pub fn as_parameter(&self) -> Option<&str>
Get the parameter name if this is a parameter, otherwise None
Sourcepub fn as_expression(&self) -> Option<&str>
pub fn as_expression(&self) -> Option<&str>
Get the expression if this is an expression, otherwise None
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Value<T>
impl<'de, T> Deserialize<'de> for Value<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Resolve<T> for Value<T>
impl<T> Resolve<T> for Value<T>
Source§fn resolve(&self, ctx: &ParameterContext) -> Result<T>
fn resolve(&self, ctx: &ParameterContext) -> Result<T>
Resolve any parameters in this object using the provided context
impl<T: Eq> Eq for Value<T>
impl<T> StructuralPartialEq for Value<T>
Auto Trait Implementations§
impl<T> Freeze for Value<T>where
T: Freeze,
impl<T> RefUnwindSafe for Value<T>where
T: RefUnwindSafe,
impl<T> Send for Value<T>where
T: Send,
impl<T> Sync for Value<T>where
T: Sync,
impl<T> Unpin for Value<T>where
T: Unpin,
impl<T> UnsafeUnpin for Value<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Value<T>where
T: UnwindSafe,
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§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