Enum serde_cbor::Value [] [src]

pub enum Value {
    U64(u64),
    I64(i64),
    Bytes(Vec<u8>),
    String(String),
    Array(Vec<Value>),
    Object(BTreeMap<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]

[src]

Returns true if the value is an object.

[src]

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

[src]

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

[src]

Returns true if the value is an array.

[src]

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

[src]

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

[src]

Returns true if the value is a byte string.

[src]

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

[src]

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

[src]

Returns true if the value is a string.

[src]

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

[src]

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

[src]

Retrns true if the value is a number.

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

Returns true if the value is a boolean.

[src]

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

[src]

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

[src]

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

Trait Implementations

impl Clone for Value
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Value
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for Value
[src]

[src]

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

[src]

This method tests for !=.

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

[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for Value
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl From<ObjectKey> for Value
[src]

[src]

Performs the conversion.

impl From<Value> for ObjectKey
[src]

[src]

Performs the conversion.

impl From<u64> for Value
[src]

[src]

Performs the conversion.

impl From<i64> for Value
[src]

[src]

Performs the conversion.

impl From<Vec<u8>> for Value
[src]

[src]

Performs the conversion.

impl From<String> for Value
[src]

[src]

Performs the conversion.

impl From<Vec<Value>> for Value
[src]

[src]

Performs the conversion.

impl From<BTreeMap<ObjectKey, Value>> for Value
[src]

[src]

Performs the conversion.

impl From<f64> for Value
[src]

[src]

Performs the conversion.

impl From<bool> for Value
[src]

[src]

Performs the conversion.