[][src]Struct lzzzz::lz4::Compressor

pub struct Compressor<'a> { /* fields omitted */ }

Streaming LZ4 compressor.

Example

use lzzzz::lz4;

let data = b"The quick brown fox jumps over the lazy dog.";
let mut buf = [0u8; 256];

// The slice should have enough capacity.
assert!(buf.len() >= lz4::max_compressed_size(data.len()));

let mut comp = lz4::Compressor::new()?;
let len = comp.next(data, &mut buf, lz4::ACC_LEVEL_DEFAULT)?;
let compressed = &buf[..len];

Implementations

impl<'a> Compressor<'a>[src]

pub fn new() -> Result<Self>[src]

Creates a new Compressor.

pub fn with_dict<D>(dict: D) -> Result<Self> where
    D: Into<Cow<'a, [u8]>>, 
[src]

Creates a new Compressor with a dictionary.

pub fn next(&mut self, src: &[u8], dst: &mut [u8], acc: i32) -> Result<usize>[src]

Performs LZ4 streaming compression.

Returns the number of bytes written into the destination buffer.

pub fn next_to_vec(
    &mut self,
    src: &[u8],
    dst: &mut Vec<u8>,
    acc: i32
) -> Result<usize>
[src]

Appends compressed data to Vec.

Returns the number of bytes appended to the given Vec<u8>.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Compressor<'a>

impl<'a> Send for Compressor<'a>

impl<'a> !Sync for Compressor<'a>

impl<'a> Unpin for Compressor<'a>

impl<'a> UnwindSafe for Compressor<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.