[][src]Struct cloudflare_zlib::Deflate

pub struct Deflate { /* fields omitted */ }

Implementations

impl Deflate[src]

Compress

pub fn new_default() -> Result<Self, ZError>[src]

pub fn new(
    level: c_int,
    strategy: c_int,
    window_bits: c_int
) -> Result<Self, ZError>
[src]

Use zlib's magic constants:

  • level = Z_BEST_SPEED (1) to Z_BEST_COMPRESSION (9)
  • strategy = Z_DEFAULT_STRATEGY, Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED
  • window_bits = 15

pub fn new_with_vec(
    level: c_int,
    strategy: c_int,
    window_bits: c_int,
    buf: Vec<u8>
) -> Result<Self, ZError>
[src]

Same as new, but can append to any Vec

pub fn reserve(&mut self, compressed_size: usize)[src]

Expect (remaining) data to take this much space after compression

pub fn compress(&mut self, data: &[u8]) -> Result<(), ZError>[src]

Add bytes from data to compressed data

pub fn compress_with_limit(
    &mut self,
    data: &[u8],
    max_size: &AtomicUsize
) -> Result<(), ZError>
[src]

dd bytes from data to compressed data, unless the total compressed output would exceed max_size

pub fn finish(self) -> Result<Vec<u8>, ZError>[src]

Trait Implementations

impl Drop for Deflate[src]

Auto Trait Implementations

impl RefUnwindSafe for Deflate

impl !Send for Deflate

impl !Sync for Deflate

impl Unpin for Deflate

impl UnwindSafe for Deflate

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.