pub enum Value {
Null,
Bool(bool),
Integer(i64),
Unsigned(u64),
Float(f64),
String(String),
Array(Vec<Value>),
Object(BTreeMap<String, Value>),
}Expand description
Custom Value IR independent of any format crate. Supports all formats: JSON, TOML, YAML, dotenv, and INI.
Variants§
Null
Bool(bool)
Integer(i64)
Unsigned(u64)
Float(f64)
String(String)
Array(Vec<Value>)
Object(BTreeMap<String, Value>)
Object map. Keys are stored sorted (BTreeMap), not in insertion order.
Implementations§
Source§impl Value
impl Value
pub fn is_null(&self) -> bool
pub fn is_bool(&self) -> bool
pub fn as_bool(&self) -> Option<bool>
pub fn is_integer(&self) -> bool
pub fn as_integer(&self) -> Option<i64>
pub fn as_unsigned(&self) -> Option<u64>
pub fn is_float(&self) -> bool
pub fn as_float(&self) -> Option<f64>
pub fn is_string(&self) -> bool
pub fn as_str(&self) -> Option<&str>
pub fn is_array(&self) -> bool
pub fn as_array(&self) -> Option<&Vec<Value>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Value>>
pub fn is_object(&self) -> bool
pub fn as_object(&self) -> Option<&BTreeMap<String, Value>>
pub fn as_object_mut(&mut self) -> Option<&mut BTreeMap<String, Value>>
pub fn get(&self, key: &str) -> Option<&Value>
pub fn get_mut(&mut self, key: &str) -> Option<&mut Value>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
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