Struct async_compression::tokio::bufread::ZstdDecoder
source · pub struct ZstdDecoder<R> { /* private fields */ }
Expand description
A zstd decoder, or decompressor
This structure implements an AsyncRead
interface and will
read compressed data from an underlying stream and emit a stream of uncompressed data.
Implementations§
source§impl<R: AsyncBufRead> ZstdDecoder<R>
impl<R: AsyncBufRead> ZstdDecoder<R>
sourcepub fn new(read: R) -> ZstdDecoder<R>
pub fn new(read: R) -> ZstdDecoder<R>
Creates a new decoder which will read compressed data from the given stream and emit a uncompressed stream.
sourcepub fn with_params(inner: R, params: &[DParameter]) -> Self
pub fn with_params(inner: R, params: &[DParameter]) -> Self
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: R, dictionary: &[u8]) -> Result<Self>
pub fn with_dict(inner: R, dictionary: &[u8]) -> Result<Self>
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.
sourcepub fn multiple_members(&mut self, enabled: bool)
pub fn multiple_members(&mut self, enabled: bool)
Configure multi-member/frame decoding, if enabled this will reset the decoder state when reaching the end of a compressed member/frame and expect either EOF or another compressed member/frame to follow it in the stream.
sourcepub fn get_ref(&self) -> &R
pub fn get_ref(&self) -> &R
Acquires a reference to the underlying reader that this decoder is wrapping.
sourcepub fn get_mut(&mut self) -> &mut R
pub fn get_mut(&mut self) -> &mut R
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 Self>) -> Pin<&mut R>
pub fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut R>
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) -> R
pub fn into_inner(self) -> R
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<R: AsyncBufRead> AsyncRead for ZstdDecoder<R>
impl<R: AsyncBufRead> AsyncRead for ZstdDecoder<R>
source§impl<R: Debug> Debug for ZstdDecoder<R>
impl<R: Debug> Debug for ZstdDecoder<R>
impl<'__pin, R> Unpin for ZstdDecoder<R>where
__Origin<'__pin, R>: Unpin,
Auto Trait Implementations§
impl<R> Freeze for ZstdDecoder<R>where
R: Freeze,
impl<R> RefUnwindSafe for ZstdDecoder<R>where
R: RefUnwindSafe,
impl<R> Send for ZstdDecoder<R>where
R: Send,
impl<R> Sync for ZstdDecoder<R>where
R: Sync,
impl<R> !UnwindSafe for ZstdDecoder<R>
Blanket Implementations§
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