Enum ledb_actix::Value

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

An enum over all possible CBOR types.

Variants

U64(u64)

Represents an unsigned integer.

I64(i64)

Represents a signed integer.

Bytes(Vec<u8, Global>)

Represents a byte string.

String(String)

Represents an UTF-8 string.

Array(Vec<Value, Global>)

Represents a list.

Object(BTreeMap<ObjectKey, Value, Global>)

Represents a map.

F64(f64)

Represents a floating point value.

Bool(bool)

Represents a boolean value.

Null

Represents the absence of a value or the value undefined.

Implementations

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

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Get the name of primary field
Get other key fields (indexes)
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.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
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
Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more
Returns the address of self. 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.

Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more
Returns the address of self. Read more
Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.