[−][src]Enum json_spanned_value::Value
A basic un-Spanned value, with Spanned children.
Unless you want to match
it, you probably want spanned::Value.
Variants
null
Bool(bool)
true
or false
Number(Number)
A number like 123
String(String)
A string like "asdf"
An array like [1, 2, 3]
An object like {"a": 1, "b": 2}
Implementations
impl Value
[src]
pub fn is_null(&self) -> bool
[src]
True if self is null
pub fn is_bool(&self) -> bool
[src]
True if self is true
or false
pub fn is_number(&self) -> bool
[src]
True if self is a number like 123
pub fn is_string(&self) -> bool
[src]
True if self is a string like "asdf"
pub fn is_array(&self) -> bool
[src]
True if self is an array like [1, 2, 3]
pub fn is_object(&self) -> bool
[src]
True if self is an object like {"a": 1, "b": 2}
pub fn as_null(&self) -> Option<()>
[src]
Some(()) if self is
null`
pub fn as_bool(&self) -> Option<bool>
[src]
Some(inner)
if self is true
or false
pub fn as_number(&self) -> Option<&Number>
[src]
Some(&inner)
if self is a number like 123
pub fn as_string(&self) -> Option<&str>
[src]
Some(&inner)
if self is a string like "asdf"
pub fn as_array(&self) -> Option<&Vec<Spanned<Value>>>
[src]
Some(&inner)
if self is an array like [1, 2, 3]
pub fn as_object(&self) -> Option<&Map<Spanned<String>, Spanned<Value>>>
[src]
Some(&inner)
if self is an object like {"a": 1, "b": 2}
pub fn as_bool_mut(&mut self) -> Option<&mut bool>
[src]
Some(&mut v)
if self is true
or false
pub fn as_number_mut(&mut self) -> Option<&mut Number>
[src]
Some(&mut v)
if self is a number like 123
pub fn as_string_mut(&mut self) -> Option<&mut String>
[src]
Some(&mut v)
if self is a string like "asdf"
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Spanned<Value>>>
[src]
Some(&mut v)
if self is an array like [1, 2, 3]
pub fn as_object_mut(
&mut self
) -> Option<&mut Map<Spanned<String>, Spanned<Value>>>
[src]
&mut self
) -> Option<&mut Map<Spanned<String>, Spanned<Value>>>
Some(&mut v)
if self is an object like {"a": 1, "b": 2}
pub fn into_null(self) -> Result<(), Self>
[src]
Ok(inner)
if self is null
, otherwise Err(self)
pub fn into_bool(self) -> Result<bool, Self>
[src]
Ok(inner)
if self is true
or false
, otherwise Err(self)
pub fn into_number(self) -> Result<Number, Self>
[src]
Ok(inner)
if self is a number like 123
, otherwise Err(self)
pub fn into_string(self) -> Result<String, Self>
[src]
Ok(inner)
if self is a string like "asdf"
, otherwise Err(self)
pub fn into_array(self) -> Result<Vec<Spanned<Value>>, Self>
[src]
Ok(inner)
if self is an array like [1, 2, 3]
, otherwise Err(self)
pub fn into_object(self) -> Result<Map<Spanned<String>, Spanned<Value>>, Self>
[src]
Ok(inner)
if self is an object like {"a": 1, "b": 2}
, otherwise Err(self)
pub fn type_str(&self) -> &'static str
[src]
A human-readable representation of the type of this value
Trait Implementations
impl Debug for Value
[src]
impl<'de> Deserialize<'de> for Value
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,