Skip to main content

EncodeV2

Trait EncodeV2 

Source
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 WriteBuffer for output, which will support uninitialized buffer.

Required Methods§

Source

fn encode( &mut self, input: &mut PartialBuffer<&[u8]>, output: &mut WriteBuffer<'_>, ) -> Result<()>

Source

fn flush(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>

Returns whether the internal buffers are flushed

Source

fn finish(&mut self, output: &mut WriteBuffer<'_>) -> Result<bool>

Returns whether the internal buffers are flushed and the end of the stream is written

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§