pub enum Value<'buf> {
Null,
True,
False,
String(RawStr<'buf>),
Number(&'buf str),
Array(Vec<Element<'buf>>),
Object(Vec<Field<'buf>>),
}Expand description
A JSON value that borrows its content from the source JSON &str.
Variants§
Null
JSON null literal.
True
JSON true literal.
False
JSON false literal.
String(RawStr<'buf>)
String content with quotes removed; escape sequences are not decoded.
Number(&'buf str)
Raw number text; not guaranteed to fit any specific numeric type.
Array(Vec<Element<'buf>>)
Ordered list of child elements.
Object(Vec<Field<'buf>>)
Ordered list of key-value fields.
Implementations§
Source§impl<'buf> Value<'buf>
impl<'buf> Value<'buf>
pub fn kind(&self) -> ValueKind
pub fn is_null(&self) -> bool
pub fn as_array(&self) -> Option<&[Element<'buf>]>
pub fn as_number(&self) -> Option<&str>
Sourcepub fn to_raw_str(&self) -> Option<RawStr<'buf>>
pub fn to_raw_str(&self) -> Option<RawStr<'buf>>
Return Some(&str) if the Value is a String.
Sourcepub fn as_object_fields(&self) -> Option<&[Field<'buf>]>
pub fn as_object_fields(&self) -> Option<&[Field<'buf>]>
Return Some(&[Field]) if the Value is a Object.
Trait Implementations§
impl<'buf> Eq for Value<'buf>
Source§impl<'buf> PartialEq for Value<'buf>
impl<'buf> PartialEq for Value<'buf>
impl<'buf> StructuralPartialEq for Value<'buf>
Auto Trait Implementations§
impl<'buf> !Send for Value<'buf>
impl<'buf> !Sync for Value<'buf>
impl<'buf> Freeze for Value<'buf>
impl<'buf> RefUnwindSafe for Value<'buf>
impl<'buf> Unpin for Value<'buf>
impl<'buf> UnsafeUnpin for Value<'buf>
impl<'buf> UnwindSafe for Value<'buf>
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