pub struct Bz3State { /* private fields */ }Expand description
Wrapper for the raw Bz3State.
Implementations§
Source§impl Bz3State
impl Bz3State
pub const fn as_raw(&mut self) -> *mut bz3_state
pub fn error(&mut self) -> &'static str
Sourcepub fn encode_block(
&mut self,
buf: &mut [u8],
input_size: usize,
) -> Result<usize>
pub fn encode_block( &mut self, buf: &mut [u8], input_size: usize, ) -> Result<usize>
Compresses a block in-place.
input_sizeis the original data size before compression. It must not exceed the block size associated with the state.bufmust be able to hold the data after compression. That’s,buf.len() >= bound(input_size)must be required, in some cases where the compressed data is larger than the original one.
Returns the size of data written to buf.
Sourcepub fn decode_block(
&mut self,
buf: &mut [u8],
compressed_size: usize,
original_size: usize,
) -> Result<()>
pub fn decode_block( &mut self, buf: &mut [u8], compressed_size: usize, original_size: usize, ) -> Result<()>
Decompresses a block in-place.
buf must be able to hold both compressed and original data.
The original doc states as below:
buffermust be able to hold at leastbz3_bound(orig_size)bytes- in order to ensure decompression will succeed for all possible bzip3 blocks.
- In most (but not all) cases,
orig_sizeshould usually be sufficient. - If it is not sufficient, you must allocate a buffer of size
bz3_bound(orig_size)temporarily. - If
buffer_sizeis too small,BZ3_ERR_DATA_SIZE_TOO_SMALLwill be returned. - The size must not exceed the block size associated with the state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bz3State
impl RefUnwindSafe for Bz3State
impl Unpin for Bz3State
impl UnwindSafe for Bz3State
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more