pub struct UnfilterRegion {
pub available: usize,
pub filled: usize,
}Expand description
UnfilterRegion divides a Vec<u8> buffer into three consecutive regions:
vector[0..available]- bytes that may be mutated (this typically means bytes that were decompressed earlier, but user of the buffer may also use this region for storing other data)vector[available..filled]- already decompressed bytes that need to be preserved. (Future decompressor calls may reference and copy bytes from this region. The maximumfilled - available“look back” distance for PNG compression method 0 is 32768 bytes)vector[filled..]- buffer where future decompressor calls can write additional decompressed bytes
Even though only vector[0..available] bytes can be mutated, it is allowed
to “shift” or “move” the contents of vector, as long as the:
vector[available..filled]bytes are preservedavailableandfilledoffsets are updated
Violating the invariants described above (e.g. mutating the bytes in the
vector[available..filled] region) may result in absurdly wacky
decompression output or panics, but not undefined behavior.
Fields§
§available: usizeThe past-the-end index of the region that is allowed to be modified.
filled: usizeThe past-the-end index of the region with decompressed bytes.
Implementations§
Source§impl UnfilterRegion
impl UnfilterRegion
Sourcepub fn as_buf<'data>(
&'data mut self,
buffer: &'data mut Vec<u8>,
) -> UnfilterBuf<'data>
pub fn as_buf<'data>( &'data mut self, buffer: &'data mut Vec<u8>, ) -> UnfilterBuf<'data>
Use this region to decompress new filtered rowline data.
Pass the wrapped buffer to
StreamingDecoder::update to fill it with
data and update the region indices.
May panic if invariants of UnfilterRegion are violated.
Trait Implementations§
Source§impl Clone for UnfilterRegion
impl Clone for UnfilterRegion
Source§fn clone(&self) -> UnfilterRegion
fn clone(&self) -> UnfilterRegion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for UnfilterRegion
impl Default for UnfilterRegion
Source§fn default() -> UnfilterRegion
fn default() -> UnfilterRegion
Returns the “default value” for a type. Read more
impl Copy for UnfilterRegion
Auto Trait Implementations§
impl Freeze for UnfilterRegion
impl RefUnwindSafe for UnfilterRegion
impl Send for UnfilterRegion
impl Sync for UnfilterRegion
impl Unpin for UnfilterRegion
impl UnsafeUnpin for UnfilterRegion
impl UnwindSafe for UnfilterRegion
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