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

Implementors§

Source§

impl EncodeV2 for BrotliEncoder

Available on crate feature brotli only.
Source§

impl EncodeV2 for BzEncoder

Available on crate feature bzip2 only.
Source§

impl EncodeV2 for DeflateEncoder

Available on crate feature deflate only.
Source§

impl EncodeV2 for FlateEncoder

Available on crate feature flate2 only.
Source§

impl EncodeV2 for GzipEncoder

Available on crate feature gzip only.
Source§

impl EncodeV2 for Lz4Encoder

Available on crate feature lz4 only.
Source§

impl EncodeV2 for LzmaEncoder

Available on crate feature lzma only.
Source§

impl EncodeV2 for Xz2Encoder

Available on crate feature lzma only.
Source§

impl EncodeV2 for XzEncoder

Available on crate feature xz only.
Source§

impl EncodeV2 for ZlibEncoder

Available on crate feature zlib only.
Source§

impl EncodeV2 for ZstdEncoder

Available on crate feature zstd only.