Struct tokio_serde_cbor::Encoder[][src]

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

CBOR based encoder.

This encoder can be used with tokio_io's Framed 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).

Methods

impl<Item: Serialize> Encoder<Item>
[src]

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

impl<Item: Clone> Clone for Encoder<Item>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<Item: Debug> Debug for Encoder<Item>
[src]

Formats the value using the given formatter. Read more

impl<Item: Serialize> Default for Encoder<Item>
[src]

Returns the "default value" for a type. Read more

impl<Item: Serialize> IoEncoder for Encoder<Item>
[src]

The type of items consumed by the Encoder

The type of encoding errors. Read more

Encodes a frame into the buffer provided. Read more

Auto Trait Implementations

impl<Item> !Send for Encoder<Item>

impl<Item> !Sync for Encoder<Item>