pub trait EncodeV2 {
// Required methods
fn encode(
&mut self,
input: &mut PartialBuffer<&[u8]>,
output: &mut WriteBuffer<'_>,
) -> Result<()>;
fn flush(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>;
fn finish(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>;
}Expand description
version 2 of Encode that is trait object safe.
The different from Encode is that:
- It doesn’t have any generic in it, so it is trait object safe
- It uses
WriteBufferfor output, which will support uninitialized buffer.
Required Methods§
fn encode( &mut self, input: &mut PartialBuffer<&[u8]>, output: &mut WriteBuffer<'_>, ) -> Result<()>
Sourcefn flush(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>
fn flush(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>
Returns whether the internal buffers are flushed
Sourcefn finish(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>
fn finish(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>
Returns whether the internal buffers are flushed and the end of the stream is written