pub enum Value {
Bool(bool),
I64(i64),
U64(u64),
F64(f64),
String(String),
Array(Array<Value>),
Object(Object<Value>),
}Expand description
Represents a boxed value.
Variants§
Bool(bool)
A boolean value.
I64(i64)
A signed integer value.
U64(u64)
An unsigned integer value.
F64(f64)
A floating point value.
String(String)
A string value.
Array(Array<Value>)
An array of annotated values.
Object(Object<Value>)
A mapping of strings to annotated values.
Implementations§
Source§impl Value
impl Value
Sourcepub fn describe(&self) -> ValueDescription<'_>
pub fn describe(&self) -> ValueDescription<'_>
Returns a formattable that gives a helper description of the value.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the string if this value is a string, otherwise None.
Sourcepub fn into_string(self) -> Option<String>
pub fn into_string(self) -> Option<String>
Returns the string if this value is a string, otherwise None.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D>(deserializer: D) -> Result<Value, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Value, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoValue for Value
impl IntoValue for Value
Source§fn into_value(self) -> Value
fn into_value(self) -> Value
Boxes the meta structure back into a value.
Source§fn serialize_payload<S>(
&self,
s: S,
_behavior: SkipSerialization,
) -> Result<S::Ok, S::Error>where
Self: Sized,
S: Serializer,
fn serialize_payload<S>(
&self,
s: S,
_behavior: SkipSerialization,
) -> Result<S::Ok, S::Error>where
Self: Sized,
S: Serializer,
Efficiently serializes the payload directly.
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 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