pub struct ZstdDecoder<W> { /* private fields */ }
Expand description
A zstd decoder, or decompressor
This structure implements an AsyncWrite
interface and will
take in compressed data and write it uncompressed to an underlying stream.
Implementations§
Source§impl<W> ZstdDecoder<W>where
W: AsyncWrite,
impl<W> ZstdDecoder<W>where
W: AsyncWrite,
Sourcepub fn new(read: W) -> ZstdDecoder<W>
pub fn new(read: W) -> ZstdDecoder<W>
Creates a new decoder which will take in compressed data and write it uncompressed to the given stream.
Sourcepub fn with_params(inner: W, params: &[DParameter]) -> ZstdDecoder<W>
pub fn with_params(inner: W, params: &[DParameter]) -> ZstdDecoder<W>
Creates a new decoder, using the specified parameters, which will read compressed data from the given stream and emit a decompressed stream.
Sourcepub fn with_dict(inner: W, dictionary: &[u8]) -> Result<ZstdDecoder<W>, Error>
pub fn with_dict(inner: W, dictionary: &[u8]) -> Result<ZstdDecoder<W>, Error>
Creates a new decoder, using the specified compression level and pre-trained dictionary, which will read compressed data from the given stream and emit an uncompressed stream.
Dictionaries provide better compression ratios for small files, but are required to be present during decompression. The dictionary used must be the same as the one used for compression.
§Errors
Returns error when dictionary
is not valid.
Source§impl<W> ZstdDecoder<W>
impl<W> ZstdDecoder<W>
Sourcepub fn get_ref(&self) -> &W
pub fn get_ref(&self) -> &W
Acquires a reference to the underlying reader that this decoder is wrapping.
Sourcepub fn get_mut(&mut self) -> &mut W
pub fn get_mut(&mut self) -> &mut W
Acquires a mutable reference to the underlying reader that this decoder is wrapping.
Note that care must be taken to avoid tampering with the state of the reader which may otherwise confuse this decoder.
Sourcepub fn get_pin_mut(self: Pin<&mut ZstdDecoder<W>>) -> Pin<&mut W>
pub fn get_pin_mut(self: Pin<&mut ZstdDecoder<W>>) -> Pin<&mut W>
Acquires a pinned mutable reference to the underlying reader that this decoder is wrapping.
Note that care must be taken to avoid tampering with the state of the reader which may otherwise confuse this decoder.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes this decoder returning the underlying reader.
Note that this may discard internal state of this decoder, so care should be taken to avoid losing resources when this is called.
Trait Implementations§
Source§impl<W> AsyncBufRead for ZstdDecoder<W>where
W: AsyncBufRead,
impl<W> AsyncBufRead for ZstdDecoder<W>where
W: AsyncBufRead,
Source§impl<W> AsyncRead for ZstdDecoder<W>where
W: AsyncRead,
impl<W> AsyncRead for ZstdDecoder<W>where
W: AsyncRead,
Source§impl<W> AsyncWrite for ZstdDecoder<W>where
W: AsyncWrite,
impl<W> AsyncWrite for ZstdDecoder<W>where
W: AsyncWrite,
Source§fn poll_write(
self: Pin<&mut ZstdDecoder<W>>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize, Error>>
fn poll_write( self: Pin<&mut ZstdDecoder<W>>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>
buf
into the object. Read moreSource§fn poll_flush(
self: Pin<&mut ZstdDecoder<W>>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
fn poll_flush( self: Pin<&mut ZstdDecoder<W>>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
Source§fn poll_shutdown(
self: Pin<&mut ZstdDecoder<W>>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Error>>
fn poll_shutdown( self: Pin<&mut ZstdDecoder<W>>, cx: &mut Context<'_>, ) -> Poll<Result<(), Error>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write
, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read moreSource§impl<W> Debug for ZstdDecoder<W>where
W: Debug,
impl<W> Debug for ZstdDecoder<W>where
W: Debug,
impl<'__pin, W> Unpin for ZstdDecoder<W>where
<PinnedFieldsOfHelperStruct<__Origin<'__pin, W>> as PinnedFieldsOfHelperTrait>::Actual: Unpin,
Auto Trait Implementations§
impl<W> Freeze for ZstdDecoder<W>where
W: Freeze,
impl<W> RefUnwindSafe for ZstdDecoder<W>where
W: RefUnwindSafe,
impl<W> Send for ZstdDecoder<W>where
W: Send,
impl<W> Sync for ZstdDecoder<W>where
W: Sync,
impl<W> !UnwindSafe for ZstdDecoder<W>
Blanket Implementations§
Source§impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
impl<R> AsyncBufReadExt for Rwhere
R: AsyncBufRead + ?Sized,
Source§fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
fn read_until<'a>(
&'a mut self,
byte: u8,
buf: &'a mut Vec<u8>,
) -> ReadUntil<'a, Self>where
Self: Unpin,
Source§fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
fn read_line<'a>(&'a mut self, buf: &'a mut String) -> ReadLine<'a, Self>where
Self: Unpin,
Source§fn split(self, byte: u8) -> Split<Self>
fn split(self, byte: u8) -> Split<Self>
byte
. Read moreSource§fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
fn fill_buf(&mut self) -> FillBuf<'_, Self>where
Self: Unpin,
Source§impl<R> AsyncReadExt for R
impl<R> AsyncReadExt for R
Source§fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> Read<'a, Self>where
Self: Unpin,
Source§fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
Source§fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
fn read_exact<'a>(&'a mut self, buf: &'a mut [u8]) -> ReadExact<'a, Self>where
Self: Unpin,
buf
. Read moreSource§fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
fn read_u8(&mut self) -> ReadU8<&mut Self>where
Self: Unpin,
Source§fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
fn read_i8(&mut self) -> ReadI8<&mut Self>where
Self: Unpin,
Source§fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
fn read_u16(&mut self) -> ReadU16<&mut Self>where
Self: Unpin,
Source§fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
fn read_i16(&mut self) -> ReadI16<&mut Self>where
Self: Unpin,
Source§fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
fn read_u32(&mut self) -> ReadU32<&mut Self>where
Self: Unpin,
Source§fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
fn read_i32(&mut self) -> ReadI32<&mut Self>where
Self: Unpin,
Source§fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
fn read_u64(&mut self) -> ReadU64<&mut Self>where
Self: Unpin,
Source§fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
fn read_i64(&mut self) -> ReadI64<&mut Self>where
Self: Unpin,
Source§fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
fn read_u128(&mut self) -> ReadU128<&mut Self>where
Self: Unpin,
Source§fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
fn read_i128(&mut self) -> ReadI128<&mut Self>where
Self: Unpin,
Source§fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
fn read_f32(&mut self) -> ReadF32<&mut Self>where
Self: Unpin,
Source§fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
fn read_f64(&mut self) -> ReadF64<&mut Self>where
Self: Unpin,
Source§fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
fn read_u16_le(&mut self) -> ReadU16Le<&mut Self>where
Self: Unpin,
Source§fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
fn read_i16_le(&mut self) -> ReadI16Le<&mut Self>where
Self: Unpin,
Source§fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
fn read_u32_le(&mut self) -> ReadU32Le<&mut Self>where
Self: Unpin,
Source§fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
fn read_i32_le(&mut self) -> ReadI32Le<&mut Self>where
Self: Unpin,
Source§fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
fn read_u64_le(&mut self) -> ReadU64Le<&mut Self>where
Self: Unpin,
Source§fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
fn read_i64_le(&mut self) -> ReadI64Le<&mut Self>where
Self: Unpin,
Source§fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
fn read_u128_le(&mut self) -> ReadU128Le<&mut Self>where
Self: Unpin,
Source§fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
fn read_i128_le(&mut self) -> ReadI128Le<&mut Self>where
Self: Unpin,
Source§fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
fn read_f32_le(&mut self) -> ReadF32Le<&mut Self>where
Self: Unpin,
Source§fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
fn read_f64_le(&mut self) -> ReadF64Le<&mut Self>where
Self: Unpin,
Source§fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
fn read_to_end<'a>(&'a mut self, buf: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>where
Self: Unpin,
buf
. Read more