Enum cbor_data::CborValue[][src]

pub enum CborValue<'a> {
    Array(Vec<Cow<'a, Cbor>>),
    Dict(BTreeMap<Cow<'a, Cbor>, Cow<'a, Cbor>>),
    Undefined,
    Null,
    Bool(bool),
    Number(Number<'a>),
    Timestamp {
        unix_epoch: i64,
        nanos: u32,
        tz_sec_east: i32,
    },
    Str(Cow<'a, str>),
    Bytes(Cow<'a, [u8]>),
    Invalid,
    Unknown,
}
Expand description

Lifted navigation structure for a CborValue.

You can obtain this using Cbor::decode(). This will reference existing bytes as much as possible, but in some cases it has to allocate, e.g. when some needed slices are not contiguous in the underlying Cbor.

Variants

Array(Vec<Cow<'a, Cbor>>)

Tuple Fields

0: Vec<Cow<'a, Cbor>>

Dict(BTreeMap<Cow<'a, Cbor>, Cow<'a, Cbor>>)

Tuple Fields

0: BTreeMap<Cow<'a, Cbor>, Cow<'a, Cbor>>

Undefined

Null

Bool(bool)

Tuple Fields

0: bool

Number(Number<'a>)

Tuple Fields

0: Number<'a>

Timestamp

Fields

unix_epoch: i64

timestamp value in seconds since the Unix epoch

nanos: u32

fractional part in nanoseconds, to be added

tz_sec_east: i32

timezone to use when encoding as a string

Str(Cow<'a, str>)

Tuple Fields

0: Cow<'a, str>

Bytes(Cow<'a, [u8]>)

Tuple Fields

0: Cow<'a, [u8]>

Invalid

Structural constraints for a tag are violated (like tag 0 on a number)

Unknown

Unknown tags are present, you may want to manually interpret the TaggedItem

Implementations

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

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

This method tests for !=.

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.

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

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.