pub struct Decoder(/* private fields */);Expand description
A decoder for decompressing data.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn new(params: DParams) -> Result<Self, Error>
pub fn new(params: DParams) -> Result<Self, Error>
Create a new Decoder with the given decompression parameters.
Sourcepub fn decompress(&mut self, src: &[u8]) -> Result<Vec<u8>, Error>
pub fn decompress(&mut self, src: &[u8]) -> Result<Vec<u8>, Error>
Decompress the given bytes into a new allocated Vec<u8>.
Note that the returned vector may not be aligned to the original data type’s alignment, and the caller should
ensure that the alignment is correct before transmuting it to original type. If the alignment does not match
the original data type, the bytes should be copied to a new aligned allocation before transmuting, otherwise
undefined behavior may occur. Alternatively, the caller can use Self::decompress_into and provide an already
aligned destination buffer.
Sourcepub fn decompress_into(
&mut self,
src: &[u8],
dst: &mut [MaybeUninit<u8>],
) -> Result<usize, Error>
pub fn decompress_into( &mut self, src: &[u8], dst: &mut [MaybeUninit<u8>], ) -> Result<usize, Error>
Decompress the given bytes into a pre-allocated buffer.
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl !Send for Decoder
impl !Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more