pub struct StoredWindow { /* private fields */ }Expand description
Predecessor history for a checkpoint.
An empty window means no history is required: the start of the source, a
member boundary, or an independent BGZF block. A non-empty window is
exactly WINDOW_SIZE bytes of decompressed history, held either raw or
zlib-compressed to bound resident memory.
Implementations§
Source§impl StoredWindow
impl StoredWindow
Sourcepub fn from_raw(bytes: impl Into<Vec<u8>>) -> Result<Self, IndexError>
pub fn from_raw(bytes: impl Into<Vec<u8>>) -> Result<Self, IndexError>
Stores exactly one raw DEFLATE history window.
§Errors
Returns IndexError::InvalidWindowSize unless bytes contains
exactly WINDOW_SIZE bytes.
Sourcepub const fn stored_len(&self) -> usize
pub const fn stored_len(&self) -> usize
Returns the number of bytes currently held, compressed or not.
Sourcepub const fn is_compressed(&self) -> bool
pub const fn is_compressed(&self) -> bool
Returns whether the payload is held zlib-compressed.
Sourcepub fn from_raw_maybe_compress(
bytes: impl Into<Vec<u8>>,
compress: bool,
) -> Result<Self, IndexError>
pub fn from_raw_maybe_compress( bytes: impl Into<Vec<u8>>, compress: bool, ) -> Result<Self, IndexError>
Stores bytes, optionally zlib-compressed to reduce resident memory.
History that does not shrink is stored raw. The input must contain
exactly WINDOW_SIZE bytes.
Sourcepub fn decompressed(&self) -> Result<Cow<'_, [u8]>, IndexError>
pub fn decompressed(&self) -> Result<Cow<'_, [u8]>, IndexError>
Returns the window history, expanding it when it is held compressed.
Trait Implementations§
Source§impl Clone for StoredWindow
impl Clone for StoredWindow
Source§fn clone(&self) -> StoredWindow
fn clone(&self) -> StoredWindow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more