Trait destream::en::EncodeMap [−][src]
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
.
Required methods
fn encode_key<T: IntoStream<'en> + 'en>(
&mut self,
key: T
) -> Result<(), Self::Error>
[src]
&mut self,
key: T
) -> Result<(), Self::Error>
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]
&mut self,
value: T
) -> Result<(), Self::Error>
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.
Provided methods
fn encode_entry<K: IntoStream<'en> + 'en, V: IntoStream<'en> + 'en>(
&mut self,
key: K,
value: V
) -> Result<(), Self::Error>
[src]
&mut self,
key: K,
value: V
) -> Result<(), Self::Error>
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.