pub enum Value {
Null,
Bool(bool),
Number(f64),
String(String),
Array(Vec<Self>),
Object(HashMap<String, Self>),
}Expand description
A generic value that can hold any data type.
Variants§
Null
Null value
Bool(bool)
Boolean value
Number(f64)
Numeric value
String(String)
String value
Array(Vec<Self>)
Array of values
Object(HashMap<String, Self>)
Object (key-value map)
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Self>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Self>>
Get as mutable array.
Sourcepub fn require_array(&self) -> Result<&Vec<Self>, ExecutionError>
pub fn require_array(&self) -> Result<&Vec<Self>, ExecutionError>
Get as array or return ExpectedArray error (DRY helper for apply_ methods).
Sourcepub fn extract_numbers(&self, field: &str) -> Result<Vec<f64>, ExecutionError>
pub fn extract_numbers(&self, field: &str) -> Result<Vec<f64>, ExecutionError>
Extract numeric values from array items by field name.
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 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