[−][src]Struct lzzzz::lz4::Compressor
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]
D: Into<Cow<'a, [u8]>>,
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]
&mut self,
src: &[u8],
dst: &mut Vec<u8>,
acc: i32
) -> Result<usize>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,