pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
Sequence(Vec<Value>),
Mapping(Mapping),
}Expand description
A dynamic metadata value. Integers and floats are kept distinct, and mappings preserve key order (frontmatter is order-significant to humans).
Variants§
Null
Null (~, null), and the Default.
Bool(bool)
Boolean.
Int(i64)
Integer.
Float(f64)
Float.
String(String)
String.
Sequence(Vec<Value>)
Sequence (- item).
Mapping(Mapping)
Mapping (key: value), key order preserved.
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
The string, if this is a Value::String.
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
The boolean, if this is a Value::Bool.
Sourcepub fn as_sequence(&self) -> Option<&[Value]>
pub fn as_sequence(&self) -> Option<&[Value]>
The sequence, if this is a Value::Sequence.
Sourcepub fn as_mapping(&self) -> Option<&Mapping>
pub fn as_mapping(&self) -> Option<&Mapping>
The mapping, if this is a Value::Mapping.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
true if this is Value::Null.
Sourcepub fn link_strings(&self) -> Vec<String>
pub fn link_strings(&self) -> Vec<String>
Interpret this value as a list of link strings: a bare string yields one element, a sequence yields its string-shaped elements, anything else yields nothing. This is how a relation field (single or multi) is read.
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync 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