Struct futures_cbor_codec::Encoder[][src]

pub struct Encoder<Item> { /* fields omitted */ }
Expand description

CBOR based encoder.

This encoder can be used with future_codec’s FramedWrite to encode CBOR frames. Anything that is serdes Serialize can be encoded this way (at least in theory, some values return errors when attempted to serialize).

Implementations

Creates a new encoder.

By default, it doesn’t do packed encoding (it includes struct field names) and it doesn’t prefix the frames with self-describe tag.

Turns the encoder into one with configured self-describe behaviour.

Turns the encoder into one with configured packed encoding.

If packed is true, it omits the field names from the encoded data. That makes it smaller, but it also means the decoding end must know the exact order of fields and it can’t be something like python, which would want to get a dictionary out of it.

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

Returns the “default value” for a type. Read more

The type of items consumed by encode

The type of encoding errors.

Encodes an item into the BytesMut provided by dst.

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)

recently added

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.