pub struct Decoder<'b> { /* private fields */ }
Expand description

A non-allocating CBOR decoder.

Implementations

Construct a Decoder for the given byte slice.

Decode any type that implements Decode.

Get the current decode position.

Set the current decode position.

Get a decoding probe to look ahead what is coming next.

This will not affect the decoding state of self and after the returned Probe has been dropped, decoding can continue from its current position as if probe was never called.

Decode a bool value.

Decode a u8 value.

Decode a u16 value.

Decode a u32 value.

Decode a u64 value.

Decode an i8 value.

Decode an i16 value.

Decode an i32 value.

Decode an i64 value.

Decode an f32 value.

Decode an f64 value.

Decode a char value.

Decode a byte slice.

This only decodes byte slices of definite lengths. See Decoder::bytes_iter for indefinite byte slice support.

Iterate over byte slices.

This supports indefinite byte slices by returing a byte slice on each iterator step. If a single definite slice is decoded the iterator will only yield one item.

Decode a string slice.

This only decodes string slices of definite lengths. See Decoder::str_iter for indefinite string slice support.

Iterate over string slices.

This supports indefinite string slices by returing a string slice on each iterator step. If a single definite slice is decoded the iterator will only yield one item.

Begin decoding an array.

CBOR arrays are heterogenous collections and may be of indefinite length. If the length is known it is returned as a Some, for indefinite arrays a None is returned.

Iterate over all array elements.

This supports indefinite and definite length arrays and uses the Decode trait to decode each element. Consequently only homogenous arrays are supported by this method.

Begin decoding a map.

CBOR maps are heterogenous collections (both in keys and in values) and may be of indefinite length. If the length is known it is returned as a Some, for indefinite maps a None is returned.

Iterate over all map entries.

This supports indefinite and definite length maps and uses the Decode trait to decode each key and value. Consequently only homogenous maps are supported by this method.

Decode a CBOR tag.

Decode a CBOR simple value.

Inspect the CBOR type at the current position.

Skip over the current CBOR value.

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

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.