pub enum Value<'value> {
Static(StaticNode),
String(Cow<'value, str>),
Array(Vec<Value<'value>>),
Object(Box<Object<'value>>),
}
Expand description
Borrowed JSON-DOM Value, consider using the ValueTrait
to access its content
Variants
Static(StaticNode)
Static values
String(Cow<'value, str>)
string type
Array(Vec<Value<'value>>)
array type
Object(Box<Object<'value>>)
object type
Implementations
sourceimpl<'value> Value<'value>
impl<'value> Value<'value>
sourcepub fn into_static(self) -> Value<'static>
pub fn into_static(self) -> Value<'static>
Enforces static lifetime on a borrowed value, this will force all strings to become owned COW’s, the same applies for Object keys.
sourcepub fn clone_static(&self) -> Value<'static>
pub fn clone_static(&self) -> Value<'static>
Clones the current value and enforces a static lifetime, it works the same
as into_static
but includes cloning logic
Trait Implementations
sourceimpl<'value> Builder<'value> for Value<'value>
impl<'value> Builder<'value> for Value<'value>
sourcefn array_with_capacity(capacity: usize) -> Self
fn array_with_capacity(capacity: usize) -> Self
Returns an empty array with a given capacity
sourcefn object_with_capacity(capacity: usize) -> Self
fn object_with_capacity(capacity: usize) -> Self
Returns an empty object with a given capacity
sourceimpl<'de> Deserialize<'de> for Value<'de>
impl<'de> Deserialize<'de> for Value<'de>
sourcefn deserialize<D>(deserializer: D) -> Result<Value<'de>, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Value<'de>, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'de> Deserializer<'de> for Value<'de>
impl<'de> Deserializer<'de> for Value<'de>
type Error = Error
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
sourcefn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
Require the Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read more
sourcefn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an optional value. Read more
sourcefn deserialize_enum<V>(
self,
_name: &str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
_name: &str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an enum value with a
particular name and possible variants. Read more
sourcefn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a newtype struct with a
particular name. Read more
sourcefn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a struct with a particular
name and fields. Read more
sourcefn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a bool
value.
sourcefn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i8
value.
sourcefn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i16
value.
sourcefn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i32
value.
sourcefn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i64
value.
sourcefn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i128
value. Read more
sourcefn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u8
value.
sourcefn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u16
value.
sourcefn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u32
value.
sourcefn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u64
value.
sourcefn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an u128
value. Read more
sourcefn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f32
value.
sourcefn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f64
value.
sourcefn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a char
value.
sourcefn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit value.
sourcefn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit struct with a
particular name. Read more
sourcefn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values.
sourcefn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data. Read more
sourcefn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a tuple struct with a
particular name and number of fields. Read more
sourcefn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a map of key-value pairs.
sourcefn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant. Read more
sourcefn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read more
sourcefn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Determine whether Deserialize
implementations should expect to
deserialize their human-readable form. Read more
sourceimpl<'de> Deserializer<'de> for &'de Value<'de>
impl<'de> Deserializer<'de> for &'de Value<'de>
type Error = Error
type Error = Error
The error type that can be returned if some error occurs during deserialization. Read more
sourcefn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
Require the Deserializer
to figure out how to drive the visitor based
on what data type is in the input. Read more
sourcefn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_option<V>(self, visitor: V) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an optional value. Read more
sourcefn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_newtype_struct<V>(
self,
_name: &'static str,
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a newtype struct with a
particular name. Read more
sourcefn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a struct with a particular
name and fields. Read more
sourcefn deserialize_enum<V>(
self,
_name: &str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
fn deserialize_enum<V>(
self,
_name: &str,
_variants: &'static [&'static str],
visitor: V
) -> Result<V::Value, Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an enum value with a
particular name and possible variants. Read more
sourcefn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a bool
value.
sourcefn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i8
value.
sourcefn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i16
value.
sourcefn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i32
value.
sourcefn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i64
value.
sourcefn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an i128
value. Read more
sourcefn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u8
value.
sourcefn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u16
value.
sourcefn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u32
value.
sourcefn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a u64
value.
sourcefn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting an u128
value. Read more
sourcefn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f32
value.
sourcefn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a f64
value.
sourcefn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_char<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a char
value.
sourcefn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_str<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and does
not benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_string<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a string value and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and does not
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a byte array and would
benefit from taking ownership of buffered data owned by the
Deserializer
. Read more
sourcefn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_unit<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit value.
sourcefn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_unit_struct<V>(
self,
name: &'static str,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a unit struct with a
particular name. Read more
sourcefn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values.
sourcefn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_tuple<V>(
self,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a sequence of values and
knows how many values there are without looking at the serialized data. Read more
sourcefn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_tuple_struct<V>(
self,
name: &'static str,
len: usize,
visitor: V
) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a tuple struct with a
particular name and number of fields. Read more
sourcefn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_map<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting a map of key-value pairs.
sourcefn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type is expecting the name of a struct
field or the discriminant of an enum variant. Read more
sourcefn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> where
V: Visitor<'de>,
Hint that the Deserialize
type needs to deserialize a value whose type
doesn’t matter because it is ignored. Read more
sourcefn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Determine whether Deserialize
implementations should expect to
deserialize their human-readable form. Read more
sourceimpl<'value> From<StaticNode> for Value<'value>
impl<'value> From<StaticNode> for Value<'value>
sourcefn from(s: StaticNode) -> Self
fn from(s: StaticNode) -> Self
Converts to this type from the input type.
sourceimpl From<Value<'_>> for Value
impl From<Value<'_>> for Value
sourcefn from(b: BorrowedValue<'_>) -> Self
fn from(b: BorrowedValue<'_>) -> Self
Converts to this type from the input type.
sourceimpl<'value> From<Value> for Value<'value>
impl<'value> From<Value> for Value<'value>
sourcefn from(b: OwnedValue) -> Self
fn from(b: OwnedValue) -> Self
Converts to this type from the input type.
sourceimpl<'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'value>
impl<'value, K: Into<Cow<'value, str>>, V: Into<Value<'value>>> FromIterator<(K, V)> for Value<'value>
sourceimpl<'value, V: Into<Value<'value>>> FromIterator<V> for Value<'value>
impl<'value, V: Into<Value<'value>>> FromIterator<V> for Value<'value>
sourcefn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<'de> IntoDeserializer<'de, Error> for Value<'de>
impl<'de> IntoDeserializer<'de, Error> for Value<'de>
type Deserializer = Value<'de>
type Deserializer = Value<'de>
The type of the deserializer being converted into.
sourcefn into_deserializer(self) -> Self::Deserializer
fn into_deserializer(self) -> Self::Deserializer
Convert this value into a deserializer.
sourceimpl<'value> Mutable for Value<'value>
impl<'value> Mutable for Value<'value>
sourcefn as_array_mut(&mut self) -> Option<&mut Vec<Value<'value>>>
fn as_array_mut(&mut self) -> Option<&mut Vec<Value<'value>>>
Tries to represent the value as an array and returns a mutable refference to it
sourcefn as_object_mut(
&mut self
) -> Option<&mut HashMap<<Self as ValueAccess>::Key, Self>>
fn as_object_mut(
&mut self
) -> Option<&mut HashMap<<Self as ValueAccess>::Key, Self>>
Tries to represent the value as an object and returns a mutable refference to it
sourcefn insert<K, V>(
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError> where
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash,
Self::Key: Eq,
fn insert<K, V>(
&mut self,
k: K,
v: V
) -> Result<Option<Self::Target>, AccessError> where
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash,
Self::Key: Eq,
Insert into this Value
as an Object
.
Will return an AccessError::NotAnObject
if called
on a Value
that isn’t an object - otherwise will
behave the same as HashMap::insert
Read more
sourcefn try_insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Target> where
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash,
Self::Key: Eq,
fn try_insert<K, V>(&mut self, k: K, v: V) -> Option<Self::Target> where
K: Into<Self::Key>,
V: Into<Self::Target>,
Self::Key: Hash,
Self::Key: Eq,
Tries to insert into this Value
as an Object
.
If the Value
isn’t an object this opoeration will
return None
and have no effect. Read more
sourcefn remove<Q>(&mut self, k: &Q) -> Result<Option<Self::Target>, AccessError> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn remove<Q>(&mut self, k: &Q) -> Result<Option<Self::Target>, AccessError> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Remove from this Value
as an Object
.
Will return an AccessError::NotAnObject
if called
on a Value
that isn’t an object - otherwise will
behave the same as HashMap::remove
Read more
sourcefn try_remove<Q>(&mut self, k: &Q) -> Option<Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn try_remove<Q>(&mut self, k: &Q) -> Option<Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to remove from this Value
as an Object
.
If the Value
isn’t an object this opoeration will
return None
and have no effect. Read more
sourcefn push<V>(&mut self, v: V) -> Result<(), AccessError> where
V: Into<Self::Target>,
fn push<V>(&mut self, v: V) -> Result<(), AccessError> where
V: Into<Self::Target>,
Pushes to this Value
as an Array
.
Will return an AccessError::NotAnArray
if called
on a Value
that isn’t an Array
- otherwise will
behave the same as Vec::push
Read more
sourcefn try_push<V>(&mut self, v: V) where
V: Into<Self::Target>,
fn try_push<V>(&mut self, v: V) where
V: Into<Self::Target>,
Tries to push to a Value
if as an Array
.
This funciton will have no effect if Value
is of
a different type Read more
sourcefn pop(&mut self) -> Result<Option<Self::Target>, AccessError>
fn pop(&mut self) -> Result<Option<Self::Target>, AccessError>
Pops from this Value
as an Array
.
Will return an AccessError::NotAnArray
if called
on a Value
that isn’t an Array
- otherwise will
behave the same as Vec::pop
Read more
sourcefn try_pop(&mut self) -> Option<Self::Target>
fn try_pop(&mut self) -> Option<Self::Target>
Tries to pop from a Value
as an Array
.
if the Value
is any other type None
will
always be returned Read more
sourcefn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Same as get
but returns a mutable ref instead
sourcefn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>
fn get_idx_mut(&mut self, i: usize) -> Option<&mut Self::Target>
Same as get_idx
but returns a mutable ref instead
sourceimpl<'v, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'v> where
K: AsRef<str> + Hash + Eq,
Value<'v>: PartialEq<T>,
S: BuildHasher,
impl<'v, K, T, S> PartialEq<HashMap<K, T, S>> for Value<'v> where
K: AsRef<str> + Hash + Eq,
Value<'v>: PartialEq<T>,
S: BuildHasher,
sourceimpl<'value> TryFrom<Value> for BorrowedValue<'value>
impl<'value> TryFrom<Value> for BorrowedValue<'value>
type Error = SerdeConversionError
type Error = SerdeConversionError
The type returned in the event of a conversion error.
sourcefn try_from(item: Value) -> Result<Self, SerdeConversionError>
fn try_from(item: Value) -> Result<Self, SerdeConversionError>
Performs the conversion.
sourceimpl<'value> TryInto<Value> for BorrowedValue<'value>
impl<'value> TryInto<Value> for BorrowedValue<'value>
type Error = SerdeConversionError
type Error = SerdeConversionError
The type returned in the event of a conversion error.
sourcefn try_into(self) -> Result<Value, SerdeConversionError>
fn try_into(self) -> Result<Value, SerdeConversionError>
Performs the conversion.
sourceimpl<'value> Value for Value<'value>
impl<'value> Value for Value<'value>
sourcefn value_type(&self) -> ValueType
fn value_type(&self) -> ValueType
Returns the type of the current Valye
sourcefn is_integer(&self) -> bool
fn is_integer(&self) -> bool
returns true if the current value a integer number
sourcefn is_f64_castable(&self) -> bool
fn is_f64_castable(&self) -> bool
returns true if the current value can be cast into a f64
sourceimpl<'value> ValueAccess for Value<'value>
impl<'value> ValueAccess for Value<'value>
type Object = HashMap<<Value<'value> as ValueAccess>::Key, Value<'value>, RandomState>
type Object = HashMap<<Value<'value> as ValueAccess>::Key, Value<'value>, RandomState>
The object structure
sourcefn cast_f64(&self) -> Option<f64>
fn cast_f64(&self) -> Option<f64>
Casts the current value to a f64 if possible, this will turn integer values into floats. Read more
sourcefn as_array(&self) -> Option<&Vec<Value<'value>>>
fn as_array(&self) -> Option<&Vec<Value<'value>>>
Tries to represent the value as an array and returns a refference to it
sourcefn as_object(&self) -> Option<&HashMap<Self::Key, Self>>
fn as_object(&self) -> Option<&HashMap<Self::Key, Self>>
Tries to represent the value as an object and returns a refference to it
sourcefn get<Q>(&self, k: &Q) -> Option<&Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get<Q>(&self, k: &Q) -> Option<&Self::Target> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Gets a ref to a value based on a key, returns None
if the
current Value isn’t an Object or doesn’t contain the key
it was asked for. Read more
sourcefn contains_key<Q>(&self, k: &Q) -> bool where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn contains_key<Q>(&self, k: &Q) -> bool where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Checks if a Value contains a given key. This will return flase if Value isn’t an object Read more
sourcefn get_idx(&self, i: usize) -> Option<&Self::Target>
fn get_idx(&self, i: usize) -> Option<&Self::Target>
Gets a ref to a value based on n index, returns None
if the
current Value isn’t an Array or doesn’t contain the index
it was asked for. Read more
sourcefn get_bool<Q>(&self, k: &Q) -> Option<bool> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_bool<Q>(&self, k: &Q) -> Option<bool> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a bool
sourcefn get_i128<Q>(&self, k: &Q) -> Option<i128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_i128<Q>(&self, k: &Q) -> Option<i128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i128
sourcefn get_i64<Q>(&self, k: &Q) -> Option<i64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_i64<Q>(&self, k: &Q) -> Option<i64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i64
sourcefn get_i32<Q>(&self, k: &Q) -> Option<i32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_i32<Q>(&self, k: &Q) -> Option<i32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i32
sourcefn get_i16<Q>(&self, k: &Q) -> Option<i16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_i16<Q>(&self, k: &Q) -> Option<i16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i16
sourcefn get_i8<Q>(&self, k: &Q) -> Option<i8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_i8<Q>(&self, k: &Q) -> Option<i8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a i8
sourcefn get_u128<Q>(&self, k: &Q) -> Option<u128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_u128<Q>(&self, k: &Q) -> Option<u128> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u128
sourcefn get_u64<Q>(&self, k: &Q) -> Option<u64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_u64<Q>(&self, k: &Q) -> Option<u64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u64
sourcefn get_usize<Q>(&self, k: &Q) -> Option<usize> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_usize<Q>(&self, k: &Q) -> Option<usize> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a usize
sourcefn get_u32<Q>(&self, k: &Q) -> Option<u32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_u32<Q>(&self, k: &Q) -> Option<u32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u32
sourcefn get_u16<Q>(&self, k: &Q) -> Option<u16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_u16<Q>(&self, k: &Q) -> Option<u16> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u16
sourcefn get_u8<Q>(&self, k: &Q) -> Option<u8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_u8<Q>(&self, k: &Q) -> Option<u8> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a u8
sourcefn get_f64<Q>(&self, k: &Q) -> Option<f64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_f64<Q>(&self, k: &Q) -> Option<f64> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a f64
sourcefn get_f32<Q>(&self, k: &Q) -> Option<f32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_f32<Q>(&self, k: &Q) -> Option<f32> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a f32
sourcefn get_str<Q>(&self, k: &Q) -> Option<&str> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
fn get_str<Q>(&self, k: &Q) -> Option<&str> where
Q: Hash + Eq + Ord + ?Sized,
Self::Key: Borrow<Q>,
Self::Key: Hash,
Self::Key: Eq,
Tries to get an element of an object as a str
sourceimpl<'value> Writable for Value<'value>
impl<'value> Writable for Value<'value>
Auto Trait Implementations
impl<'value> RefUnwindSafe for Value<'value>
impl<'value> Send for Value<'value>
impl<'value> Sync for Value<'value>
impl<'value> Unpin for Value<'value>
impl<'value> UnwindSafe for Value<'value>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more