Struct BzDecoder
pub struct BzDecoder<W: Write> { /* private fields */ }
A compression stream which will have compressed data written to it and will write uncompressed data to an output stream.
Implementations
impl<W: Write> BzDecoder<W>
fn new(obj: W) -> SelfCreate a new decoding stream which will decompress all data written to it into
obj.fn get_ref(&self) -> &WAcquires a reference to the underlying writer.
fn get_mut(&mut self) -> &mut WAcquires a mutable reference to the underlying writer.
Note that mutating the output/input state of the stream may corrupt this object, so care must be taken when using this method.
fn try_finish(&mut self) -> Result<()>Attempt to finish this output stream, writing out final chunks of data.
Note that this function can only be used once data has finished being written to the output stream. After this function is called then further calls to
writemay result in a panic.Panics
Attempts to write data to this stream may result in a panic after this function is called.
fn finish(&mut self) -> Result<W>Unwrap the underlying writer, finishing the compression stream.
Note that this function may not be suitable to call in a situation where the underlying stream is an asynchronous I/O stream. To finish a stream the
try_finish(orshutdown) method should be used instead. To re-acquire ownership of a stream it is safe to call this method aftertry_finishorshutdownhas returnedOk.fn total_out(&self) -> u64Returns the number of bytes produced by the decompressor
Note that, due to buffering, this only bears any relation to
total_inafter a call toflush. At that point,total_in() / total_out()is the compression ratio.fn total_in(&self) -> u64Returns the number of bytes consumed by the decompressor (e.g. the number of bytes written to this stream.)
Trait Implementations
impl<W: Write> Drop for BzDecoder<W>
fn drop(&mut self)
impl<W: Write> Write for BzDecoder<W>
fn write(&mut self, data: &[u8]) -> Result<usize>fn flush(&mut self) -> Result<()>
Auto Trait Implementations
impl<W> Freeze for BzDecoder<W>
where
Option<W>: Freeze,
impl<W> RefUnwindSafe for BzDecoder<W>
where
Option<W>: RefUnwindSafe,
impl<W> Send for BzDecoder<W>
where
Option<W>: Send,
impl<W> Sync for BzDecoder<W>
where
Option<W>: Sync,
impl<W> Unpin for BzDecoder<W>
where
Option<W>: Unpin,
impl<W> UnsafeUnpin for BzDecoder<W>
where
Option<W>: UnsafeUnpin,
impl<W> UnwindSafe for BzDecoder<W>
where
Option<W>: UnwindSafe,
Blanket Implementations
impl<T> Any for BzDecoder<W>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for BzDecoder<W>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for BzDecoder<W>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for BzDecoder<W>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for BzDecoder<W>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for BzDecoder<W>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for BzDecoder<W>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>