pub struct Reader<R> { /* private fields */ }
Expand description

Wraps a std::io::Read and reads length-delimited CBOR values.

Implementations

Create a new reader with a max. buffer size of 512KiB.

Create a new reader with a max. buffer size of 512KiB.

Set the max. buffer size in bytes.

If length values greater than this are decoded, an Error::InvalidLen will be returned.

Get a reference to the inner reader.

Get a mutable reference to the inner reader.

Deconstruct this reader into the inner reader and the buffer.

Read the next CBOR value and decode it.

The value is assumed to be preceded by a u32 (4 bytes in network byte order) denoting the length of the CBOR item in bytes.

Reading 0 bytes when decoding the length prefix results in Ok(None), otherwise either Some value or an error is returned.

Like Reader::read but accepting a user provided decoding context.

Trait Implementations

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 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.