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
Implementors§
impl EncodeV2 for BrotliEncoder
Available on crate feature
brotli only.impl EncodeV2 for BzEncoder
Available on crate feature
bzip2 only.impl EncodeV2 for DeflateEncoder
Available on crate feature
deflate only.impl EncodeV2 for FlateEncoder
Available on crate feature
flate2 only.impl EncodeV2 for GzipEncoder
Available on crate feature
gzip only.impl EncodeV2 for Lz4Encoder
Available on crate feature
lz4 only.impl EncodeV2 for LzmaEncoder
Available on crate feature
lzma only.impl EncodeV2 for Xz2Encoder
Available on crate feature
lzma only.impl EncodeV2 for XzEncoder
Available on crate feature
xz only.impl EncodeV2 for ZlibEncoder
Available on crate feature
zlib only.impl EncodeV2 for ZstdEncoder
Available on crate feature
zstd only.