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

Enforces static lifetime on a borrowed value, this will force all strings to become owned COW’s, the same applies for Object keys.

Clones the current value and enforces a static lifetime, it works the same as into_static but includes cloning logic

Trait Implementations

Returns anull value

Returns an empty array with a given capacity

Returns an empty object with a given capacity

Returns an empty array

Returns an empty object

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The error type that can be returned if some error occurs during deserialization. Read more

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more

Hint that the Deserialize type is expecting an optional value. Read more

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants. Read more

Hint that the Deserialize type is expecting a newtype struct with a particular name. Read more

Hint that the Deserialize type is expecting a struct with a particular name and fields. Read more

Hint that the Deserialize type is expecting a bool value.

Hint that the Deserialize type is expecting an i8 value.

Hint that the Deserialize type is expecting an i16 value.

Hint that the Deserialize type is expecting an i32 value.

Hint that the Deserialize type is expecting an i64 value.

Hint that the Deserialize type is expecting an i128 value. Read more

Hint that the Deserialize type is expecting a u8 value.

Hint that the Deserialize type is expecting a u16 value.

Hint that the Deserialize type is expecting a u32 value.

Hint that the Deserialize type is expecting a u64 value.

Hint that the Deserialize type is expecting an u128 value. Read more

Hint that the Deserialize type is expecting a f32 value.

Hint that the Deserialize type is expecting a f64 value.

Hint that the Deserialize type is expecting a char value.

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

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

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

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

Hint that the Deserialize type is expecting a unit value.

Hint that the Deserialize type is expecting a unit struct with a particular name. Read more

Hint that the Deserialize type is expecting a sequence of values.

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

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields. Read more

Hint that the Deserialize type is expecting a map of key-value pairs.

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant. Read more

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more

The error type that can be returned if some error occurs during deserialization. Read more

Require the Deserializer to figure out how to drive the visitor based on what data type is in the input. Read more

Hint that the Deserialize type is expecting an optional value. Read more

Hint that the Deserialize type is expecting a newtype struct with a particular name. Read more

Hint that the Deserialize type is expecting a struct with a particular name and fields. Read more

Hint that the Deserialize type is expecting an enum value with a particular name and possible variants. Read more

Hint that the Deserialize type is expecting a bool value.

Hint that the Deserialize type is expecting an i8 value.

Hint that the Deserialize type is expecting an i16 value.

Hint that the Deserialize type is expecting an i32 value.

Hint that the Deserialize type is expecting an i64 value.

Hint that the Deserialize type is expecting an i128 value. Read more

Hint that the Deserialize type is expecting a u8 value.

Hint that the Deserialize type is expecting a u16 value.

Hint that the Deserialize type is expecting a u32 value.

Hint that the Deserialize type is expecting a u64 value.

Hint that the Deserialize type is expecting an u128 value. Read more

Hint that the Deserialize type is expecting a f32 value.

Hint that the Deserialize type is expecting a f64 value.

Hint that the Deserialize type is expecting a char value.

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

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

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

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

Hint that the Deserialize type is expecting a unit value.

Hint that the Deserialize type is expecting a unit struct with a particular name. Read more

Hint that the Deserialize type is expecting a sequence of values.

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

Hint that the Deserialize type is expecting a tuple struct with a particular name and number of fields. Read more

Hint that the Deserialize type is expecting a map of key-value pairs.

Hint that the Deserialize type is expecting the name of a struct field or the discriminant of an enum variant. Read more

Hint that the Deserialize type needs to deserialize a value whose type doesn’t matter because it is ignored. Read more

Determine whether Deserialize implementations should expect to deserialize their human-readable form. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Creates a value from an iterator. Read more

Creates a value from an iterator. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the deserializer being converted into.

Convert this value into a deserializer.

Tries to represent the value as an array and returns a mutable refference to it

Tries to represent the value as an object and returns a mutable refference to it

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

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

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

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

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

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

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

Tries to pop from a Value as an Array. if the Value is any other type None will always be returned Read more

Same as get but returns a mutable ref instead

Same as get_idx but returns a mutable ref instead

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Returns the type of the current Valye

returns true if the current value is null

returns true if the current value a floatingpoint number

returns true if the current value a integer number

returns true if the current value a number either float or integer

returns true if the current value a bool

returns true if the current value can be represented as a i128

returns true if the current value can be represented as a i64

returns true if the current value can be represented as a i32

returns true if the current value can be represented as a i16

returns true if the current value can be represented as a i8

returns true if the current value can be represented as a u128

returns true if the current value can be represented as a u64

returns true if the current value can be represented as a usize

returns true if the current value can be represented as a u32

returns true if the current value can be represented as a u16

returns true if the current value can be represented as a u8

returns true if the current value can be represented as a f64

returns true if the current value can be cast into a f64

returns true if the current value can be represented as a f64

returns true if the current value can be represented as a str

returns true if the current value can be represented as a char

returns true if the current value can be represented as an array

returns true if the current value can be represented as an object

The target for nested lookups

The type for Objects

The array structure

The object structure

Tries to represent the value as a bool

Tries to represent the value as an i64

Tries to represent the value as an i128

Tries to represent the value as an u64

Tries to represent the value as a f64

Casts the current value to a f64 if possible, this will turn integer values into floats. Read more

Tries to represent the value as a &str

Tries to represent the value as an array and returns a refference to it

Tries to represent the value as an object and returns a refference to it

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

Checks if a Value contains a given key. This will return flase if Value isn’t an object Read more

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

Tries to get an element of an object as a bool

Tries to get an element of an object as a i128

Tries to get an element of an object as a i64

Tries to represent the value as an i32

Tries to get an element of an object as a i32

Tries to represent the value as an i16

Tries to get an element of an object as a i16

Tries to represent the value as an i8

Tries to get an element of an object as a i8

Tries to represent the value as an u128

Tries to get an element of an object as a u128

Tries to get an element of an object as a u64

Tries to represent the value as an usize

Tries to get an element of an object as a usize

Tries to represent the value as an u32

Tries to get an element of an object as a u32

Tries to represent the value as an u16

Tries to get an element of an object as a u16

Tries to represent the value as an u8

Tries to get an element of an object as a u8

Tries to get an element of an object as a f64

Tries to represent the value as a f32

Tries to get an element of an object as a f32

Tries to represent the value as a Char

Tries to get an element of an object as a str

Tries to get an element of an object as a array

Tries to get an element of an object as a object

Encodes the value into it’s JSON representation as a string

Encodes the value into it’s JSON representation as a string (pretty printed)

Encodes the value into it’s JSON representation into a Writer Read more

Encodes the value into it’s JSON representation into a Writer, pretty printed Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.