Struct brotli::Decompressor [] [src]

pub struct Decompressor<R: Read> {
    // some fields omitted
}

Wraps an input stream and provides methods for decompressing.

Examples

use std::io::{ Read, stdout, Write };
use brotli::Decompressor;

let brotli_stream = std::fs::File::open("data/64x.compressed").unwrap();

let mut decompressed = &mut Vec::new();
let _ = Decompressor::new(brotli_stream).read_to_end(&mut decompressed);

let mut expected = &mut Vec::new();
let _ = std::fs::File::open("data/64x").unwrap().read_to_end(&mut expected);

assert_eq!(expected, decompressed);

stdout().write_all(decompressed).ok();

Methods

impl<R: Read> Decompressor<R>

fn new(r: R) -> Decompressor<R>

Creates Decompressor from Read.

Trait Implementations

impl<R: Read> Read for Decompressor<R>

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

1.0.0fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

1.0.0fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

1.6.0fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

1.0.0fn by_ref(&mut self) -> &mut Self

1.0.0fn bytes(self) -> Bytes<Self>

fn chars(self) -> Chars<Self>

1.0.0fn chain<R>(self, next: R) -> Chain<Self, R> where R: Read

1.0.0fn take(self, limit: u64) -> Take<Self>

Derived Implementations

impl<R: Debug + Read> Debug for Decompressor<R>

fn fmt(&self, __arg_0: &mut Formatter) -> Result