pub enum Value {
Bool(bool),
Integer(i64),
Float(f64),
String(String),
List(Vec<Value>),
Dict(BTreeMap<String, Value>),
}Variants§
Implementations§
Source§impl Value
impl Value
Sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
If the Value is a boolean, return the associated bool. Returns None otherwise.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Returns true if Value is an integer, otherwise returns false.
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
If the Value is an integer, return the associated i64. Returns None otherwise.
Sourcepub fn is_float(&self) -> bool
pub fn is_float(&self) -> bool
Returns true if Value is a floating point number, otherwise returns false.
Sourcepub fn as_float(&self) -> Option<f64>
pub fn as_float(&self) -> Option<f64>
If the Value is a floating point number, return the associated f64. Returns None
otherwise.
Sourcepub fn is_number(&self) -> bool
pub fn is_number(&self) -> bool
Returns true if Value is a number (either integer or floating point), otherwise returns
false.
Sourcepub fn as_number(&self) -> Option<f64>
pub fn as_number(&self) -> Option<f64>
If the Value is numeric, returns it as a f64. Return None otherwise.
Sourcepub fn as_string(&self) -> Option<&str>
pub fn as_string(&self) -> Option<&str>
If the Value is a string, returns the associated String. Returns None otherwise.
Trait Implementations§
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