pub trait EntryEncoder: Sized {
type Cx: Context<Error = Self::Error>;
type Error;
type Mode: 'static;
type EncodeKey<'this>: Encoder<Cx = Self::Cx, Error = Self::Error, Mode = Self::Mode>
where Self: 'this;
type EncodeValue<'this>: Encoder<Cx = Self::Cx, Error = Self::Error, Mode = Self::Mode>
where Self: 'this;
// Required methods
fn cx(&self) -> Self::Cx;
fn encode_key(&mut self) -> Result<Self::EncodeKey<'_>, Self::Error>;
fn encode_value(&mut self) -> Result<Self::EncodeValue<'_>, Self::Error>;
fn finish_entry(self) -> Result<(), Self::Error>;
// Provided method
fn insert_entry<K, V>(self, key: K, value: V) -> Result<(), Self::Error>
where K: Encode<Self::Mode>,
V: Encode<Self::Mode> { ... }
}Expand description
Trait governing how to encode a map entry.
Required Associated Types§
Required Methods§
Sourcefn encode_key(&mut self) -> Result<Self::EncodeKey<'_>, Self::Error>
fn encode_key(&mut self) -> Result<Self::EncodeKey<'_>, Self::Error>
Return the encoder for the key in the entry.
Sourcefn encode_value(&mut self) -> Result<Self::EncodeValue<'_>, Self::Error>
fn encode_value(&mut self) -> Result<Self::EncodeValue<'_>, Self::Error>
Return encoder for value in the entry.
Sourcefn finish_entry(self) -> Result<(), Self::Error>
fn finish_entry(self) -> Result<(), Self::Error>
Stop encoding this pair.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.