Enum serde_cbor::value::Value [] [src]

pub enum Value {
    U64(u64),
    I64(i64),
    Bytes(Vec<u8>),
    String(String),
    Array(Vec<Value>),
    Object(HashMap<ObjectKey, Value>),
    F64(f64),
    Bool(bool),
    Null,
}

An enum over all possible CBOR types.

Variants

Represents an unsigned integer.

Represents a signed integer.

Represents a byte string.

Represents an UTF-8 string.

Represents a list.

Represents a map.

Represents a floating point value.

Represents a boolean value.

Represents the absence of a value or the value undefined.

Methods

impl Value
[src]

Returns true if the value is an object.

If the value is an object, returns the associated BTreeMap. Returns None otherwise.

If the value is an object, returns the associated mutable BTreeMap. Returns None otherwise.

Returns true if the value is an array.

If the value is an array, returns the associated Vec. Returns None otherwise.

If the value is an array, returns the associated mutable Vec. Returns None otherwise.

Returns true if the value is a byte string.

Returns the associated byte string or None if the value has a different type.

Returns the associated mutable byte string or None if the value has a different type.

Returns true if the value is a string.

Returns the associated string or None if the value has a different type.

Returns the associated mutable string or None if the value has a different type.

Retrns true if the value is a number.

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.

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

impl Clone for Value
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Value
[src]

Formats the value using the given formatter.

impl PartialEq for Value
[src]

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

This method tests for !=.

impl<'de> Deserialize<'de> for Value
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Value
[src]

Serialize this value into the given Serde serializer. Read more

impl From<ObjectKey> for Value
[src]

Performs the conversion.