Trait destream::en::EncodeMap[][src]

pub trait EncodeMap<'en> {
    type Ok: Stream + Send + Unpin + 'en;
    type Error: Error + Send + Unpin + 'en;
    fn encode_key<T: IntoStream<'en> + 'en>(
        &mut self,
        key: T
    ) -> Result<(), Self::Error>;
fn encode_value<T: IntoStream<'en> + 'en>(
        &mut self,
        value: T
    ) -> Result<(), Self::Error>;
fn end(self) -> Result<Self::Ok, Self::Error>; fn encode_entry<K: IntoStream<'en> + 'en, V: IntoStream<'en> + 'en>(
        &mut self,
        key: K,
        value: V
    ) -> Result<(), Self::Error> { ... } }

Returned from Encoder::encode_map.

Associated Types

type Ok: Stream + Send + Unpin + 'en[src]

Must match the Ok type of the parent Encoder.

type Error: Error + Send + Unpin + 'en[src]

Must match the Error type of the parent Encoder.

Loading content...

Required methods

fn encode_key<T: IntoStream<'en> + 'en>(
    &mut self,
    key: T
) -> Result<(), Self::Error>
[src]

Encode a map key.

If possible, ToStream implementations are encouraged to use encode_entry instead as it may be implemented more efficiently in some formats compared to a pair of calls to encode_key and encode_value.

fn encode_value<T: IntoStream<'en> + 'en>(
    &mut self,
    value: T
) -> Result<(), Self::Error>
[src]

Encode a map value.

Panics

Calling encode_value before encode_key is incorrect and is allowed to panic or produce bogus results.

fn end(self) -> Result<Self::Ok, Self::Error>[src]

Finish encoding the map.

Loading content...

Provided methods

fn encode_entry<K: IntoStream<'en> + 'en, V: IntoStream<'en> + 'en>(
    &mut self,
    key: K,
    value: V
) -> Result<(), Self::Error>
[src]

Encode a map entry consisting of a key and a value.

The default implementation delegates to encode_key and encode_value. This is appropriate for encoders that do not care about performance or are not able to optimize encode_entry any further.

Loading content...

Implementors

Loading content...