enum
Value
pub enum Value {
Null,
Str(String),
Num(f64),
Bool(bool),
List(Vec<Value>),
Record(BTreeMap<String, Value>),
}A runtime value. Templates are dynamically typed; Rust state is converted into Values at the scope boundary.
Variants
Methods
record
pub fn record<K: Into<String>>(fields: impl IntoIterator<Item = (K, Value)>) -> ValueBuild a record from (key, value) pairs.
to_text
pub fn to_text(&self) -> StringThe text shown when the value is interpolated into a template.
get_path
pub fn get_path(&self, segments: &[String]) -> Option<Value>Follow a field path; lists expose a len pseudo-field.
Trait implementations
- impl Clone for Value
- impl Debug for Value
- impl Default for Value
- impl From<&str> for Value
- impl From<BTreeMap<String, Value>> for Value
- impl From<String> for Value
- impl From<bool> for Value
- impl From<f32> for Value
- impl From<f64> for Value
- impl From<i32> for Value
- impl From<i64> for Value
- impl From<u32> for Value
- impl From<u64> for Value
- impl From<usize> for Value
- impl PartialEq for Value
- impl StructuralPartialEq for Value
- impl<T: Into<Value>> From<Option<T>> for Value
- impl<T: Into<Value>> From<Vec<T>> for Value