musli_core/en/
sequence_encoder.rsuse crate::Context;
use super::{Encode, Encoder};
pub trait SequenceEncoder {
type Cx: ?Sized + Context;
type Ok;
type EncodeNext<'this>: Encoder<
Cx = Self::Cx,
Ok = Self::Ok,
Error = <Self::Cx as Context>::Error,
Mode = <Self::Cx as Context>::Mode,
>
where
Self: 'this;
#[must_use = "Encoders must be consumed"]
fn encode_next(&mut self) -> Result<Self::EncodeNext<'_>, <Self::Cx as Context>::Error>;
fn finish_sequence(self) -> Result<Self::Ok, <Self::Cx as Context>::Error>;
#[inline]
fn push<T>(&mut self, value: T) -> Result<(), <Self::Cx as Context>::Error>
where
T: Encode<<Self::Cx as Context>::Mode>,
{
self.encode_next()?.encode(value)?;
Ok(())
}
}