pub enum Value {
Null,
Bool(bool),
I64(i64),
F64(f64),
Str(Rc<str>),
Safe(Rc<str>),
Array(Rc<Vec<Value>>),
Map(Rc<BTreeMap<String, Value>>),
}Expand description
A dynamic value used during template rendering.
Supports strings, numbers, booleans, null, arrays, maps, and
Safe strings that bypass auto-escaping.
Variants§
Null
Bool(bool)
I64(i64)
F64(f64)
Str(Rc<str>)
A string value. Will be auto-escaped in Mode::Html.
Safe(Rc<str>)
A string that is already safe for output. Bypasses auto-escaping.
Returned by {{ value | safe }}, the escape filter, and {{ super() }}.
Array(Rc<Vec<Value>>)
Map(Rc<BTreeMap<String, Value>>)
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_truthy(&self) -> bool
pub fn is_truthy(&self) -> bool
Returns true if the value is considered truthy.
Falsy values are: Null, false, 0, 0.0, empty string, empty array, empty map.
Sourcepub fn get(&self, key: &str) -> Option<Value>
pub fn get(&self, key: &str) -> Option<Value>
Look up a key in a map value. Returns None if not a map or key missing.
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl !Send for Value
impl !Sync for Value
impl Freeze for Value
impl RefUnwindSafe for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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