pub enum Value {
Null,
Bool(bool),
Integer(i64),
Number(f64),
Decimal(String),
String(String),
Array(Vec<Value>),
Object(Map<String, Value>),
}Variants§
Null
Bool(bool)
Integer(i64)
Number(f64)
Decimal(String)
String(String)
Array(Vec<Value>)
Object(Map<String, Value>)
Implementations§
Source§impl Value
impl Value
pub fn as_str(&self) -> Option<&str>
pub fn as_f64(&self) -> Option<f64>
pub fn as_i64(&self) -> Option<i64>
pub fn as_u64(&self) -> Option<u64>
pub fn as_bool(&self) -> Option<bool>
pub fn as_array(&self) -> Option<&[Value]>
pub fn as_object(&self) -> Option<&Map<String, Value>>
pub fn get(&self, key: &str) -> Option<&Value>
pub fn to_string_compact(&self) -> String
pub fn to_string_pretty(&self) -> String
Sourcepub fn to_string_compact_limited(&self, limit: usize) -> Option<String>
pub fn to_string_compact_limited(&self, limit: usize) -> Option<String>
Encode compact JSON, stopping before the output crosses limit bytes.
No successful partial document is returned.
Sourcepub fn write_compact_to(&self, out: &mut impl Write) -> Result
pub fn write_compact_to(&self, out: &mut impl Write) -> Result
Write canonical compact JSON to a fallible sink without an intermediate string.
Trait Implementations§
Source§impl JsonDecode for Value
impl JsonDecode for Value
Source§impl JsonEncode for Value
impl JsonEncode for Value
fn to_json_value(&self) -> Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Forget for Value
impl Freeze for Valuewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
impl Move for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Valuewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
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