Enum nu_json::value::Value[][src]

pub enum Value {
    Null,
    Bool(bool),
    I64(i64),
    U64(u64),
    F64(f64),
    String(String),
    Array(Vec<Value>),
    Object(Map<String, Value>),
}
Expand description

Represents a Hjson/JSON value

Variants

Null

Represents a JSON null value

Bool(bool)

Represents a JSON Boolean

Tuple Fields of Bool

0: bool
I64(i64)

Represents a JSON signed integer

Tuple Fields of I64

0: i64
U64(u64)

Represents a JSON unsigned integer

Tuple Fields of U64

0: u64
F64(f64)

Represents a JSON floating point number

Tuple Fields of F64

0: f64
String(String)

Represents a JSON string

Tuple Fields of String

0: String
Array(Vec<Value>)

Represents a JSON array

Tuple Fields of Array

0: Vec<Value>
Object(Map<String, Value>)

Represents a JSON object

Tuple Fields of Object

0: Map<String, Value>

Implementations

If the Value is an Object, returns the value associated with the provided key. Otherwise, returns None.

Attempts to get a nested Value Object for each key in keys. If any key is found not to exist, find_path will return None. Otherwise, it will return the Value associated with the final key.

Looks up a value by a JSON Pointer.

JSON Pointer defines a string syntax for identifying a specific value within a JavaScript Object Notation (JSON) document.

A Pointer is a Unicode string with the reference tokens separated by /. Inside tokens / is replaced by ~1 and ~ is replaced by ~0. The addressed value is returned and if there is no such value None is returned.

For more information read RFC6901.

If the Value is an Object, performs a depth-first search until a value associated with the provided key is found. If no value is found or the Value is not an Object, returns None.

Returns true if the Value is an Object. Returns false otherwise.

If the Value is an Object, returns the associated Map. Returns None otherwise.

If the Value is an Object, returns the associated mutable Map. Returns None otherwise.

Returns true if the Value is an Array. Returns false otherwise.

If the Value is an Array, returns the associated vector. Returns None otherwise.

If the Value is an Array, returns the associated mutable vector. Returns None otherwise.

Returns true if the Value is a String. Returns false otherwise.

If the Value is a String, returns the associated str. Returns None otherwise.

Returns true if the Value is a Number. Returns false otherwise.

Returns true if the Value is a i64. Returns false otherwise.

Returns true if the Value is a u64. Returns false otherwise.

Returns true if the Value is a f64. Returns false otherwise.

If the Value is a number, return or cast it to a i64. Returns None otherwise.

If the Value is a number, return or cast it to a u64. Returns None otherwise.

If the Value is a number, return or cast it to a f64. Returns None otherwise.

Returns true if the Value is a Boolean. Returns false otherwise.

If the Value is a Boolean, returns the associated bool. Returns None otherwise.

Returns true if the Value is a Null. Returns false otherwise.

If the Value is a Null, returns (). Returns None otherwise.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Serializes a Hjson value into a string

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 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 a struct with a particular name and fields. Read more

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

Serializes a Hjson value into a string

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

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

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

Performs the conversion.

Performs the conversion.

Converts the value of self to an instance of Hjson

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)

recently added

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.