Trait compu::encoder::Encoder [−][src]
Describes compression interface
Associated Types
Loading content...Associated Constants
const HAS_INTERNAL_BUFFER: bool
[src]
Specifies whether encoder has own internal buffer.
Required methods
fn new(opts: &Self::Options) -> Self
[src]
Creates new instance using provided options.
fn encode(
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)
[src]
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)
Performs encoding of data chunk.
Returns tuple that contains: remaining input to process, remaining output buffer size and whether encode is successful.
Use op
equal to EncoderOp::Finish
to specify last chunk
fn output<'a>(&'a mut self) -> Option<&'a [u8]>
[src]
Retrieves currently buffered output, that hasn’t been written yet.
Returned bytes MUST be marked as consumed by implementation.
fn compress_size_hint(&self, size: usize) -> usize
[src]
Returns estimated number of bytes, for compressed input.
Note that it might not be reliable, depending on encoder.
fn is_finished(&self) -> bool
[src]
Returns whether encoder has finished.
Provided methods
Loading content...Implementors
impl Encoder for BrotliEncoder
[src]
const HAS_INTERNAL_BUFFER: bool
[src]
type Options = BrotliOptions
fn new(opts: &Self::Options) -> Self
[src]
fn encode(
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)
[src]
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)
fn output<'a>(&'a mut self) -> Option<&'a [u8]>
[src]
fn compress_size_hint(&self, size: usize) -> usize
[src]
fn is_finished(&self) -> bool
[src]
impl Encoder for ZlibEncoder
[src]
const HAS_INTERNAL_BUFFER: bool
[src]
type Options = ZlibOptions
fn new(opts: &Self::Options) -> Self
[src]
fn encode(
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)
[src]
&mut self,
input: &[u8],
output: &mut [u8],
op: EncoderOp
) -> (usize, usize, bool)