pub trait MapEmitter: Send {
// Required methods
fn next_key(
&mut self,
state: &mut State,
) -> Result<Option<SerializeHandle<'_>>, Error>;
fn next_value(
&mut self,
state: &mut State,
) -> Result<SerializeHandle<'_>, Error>;
}Expand description
A map emitter.
Required Methods§
Sourcefn next_key(
&mut self,
state: &mut State,
) -> Result<Option<SerializeHandle<'_>>, Error>
fn next_key( &mut self, state: &mut State, ) -> Result<Option<SerializeHandle<'_>>, Error>
Produces the next key in the map.
If this reached the end of the map None shall be returned. The expectation
is that this method changes an internal state in the emitter and the next
call to next_value returns the corresponding value.
Sourcefn next_value(
&mut self,
state: &mut State,
) -> Result<SerializeHandle<'_>, Error>
fn next_value( &mut self, state: &mut State, ) -> Result<SerializeHandle<'_>, Error>
Produces the next value in the map.
§Panics
This method shall panic if the emitter is not able to produce a value because the emitter is in the wrong state.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".