Struct BzDecoder

pub struct BzDecoder<R> { /* private fields */ }

A bz2 decoder, or decompressor.

This structure implements a BufRead interface and takes a stream of compressed data as input, providing the decompressed data when read from.

Implementations

impl<R> BzDecoder<R>

fn get_ref(&self) -> &R

Acquires a reference to the underlying stream

fn get_mut(&mut self) -> &mut R

Acquires a mutable reference to the underlying stream

Note that mutation of the stream may result in surprising results if this encoder is continued to be used.

fn into_inner(self) -> R

Consumes this decoder, returning the underlying reader.

fn total_in(&self) -> u64

Returns the number of bytes that the decompressor has consumed.

Note that this will likely be smaller than what the decompressor actually read from the underlying stream due to buffering.

fn total_out(&self) -> u64

Returns the number of bytes that the decompressor has produced.

impl<R: BufRead> BzDecoder<R>

fn new(r: R) -> Self

Creates a new decoder which will decompress data read from the given stream.

Trait Implementations

impl<R: BufRead> Read for BzDecoder<R>

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

impl<W: Write> Write for BzDecoder<W>

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

Auto Trait Implementations

impl<R> Freeze for BzDecoder<R> where R: Freeze,

impl<R> RefUnwindSafe for BzDecoder<R> where R: RefUnwindSafe,

impl<R> Send for BzDecoder<R> where R: Send,

impl<R> Sync for BzDecoder<R> where R: Sync,

impl<R> Unpin for BzDecoder<R> where R: Unpin,

impl<R> UnsafeUnpin for BzDecoder<R> where R: UnsafeUnpin,

impl<R> UnwindSafe for BzDecoder<R> where R: UnwindSafe,

Blanket Implementations

impl<T> Any for BzDecoder<R> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for BzDecoder<R> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for BzDecoder<R> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for BzDecoder<R>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for BzDecoder<R> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for BzDecoder<R> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for BzDecoder<R> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>