pub struct SqpkCompressedBlock { /* private fields */ }Expand description
One DEFLATE-or-raw block of a SqpkFile payload.
Implementations§
Source§impl SqpkCompressedBlock
impl SqpkCompressedBlock
Sourcepub fn new(is_compressed: bool, decompressed_size: usize, data: Vec<u8>) -> Self
pub fn new(is_compressed: bool, decompressed_size: usize, data: Vec<u8>) -> Self
Build a block from its parsed parts (test/external use).
Sourcepub fn decompress_into(&self, w: &mut impl Write) -> Result<()>
pub fn decompress_into(&self, w: &mut impl Write) -> Result<()>
Stream the block’s decompressed bytes into w.
Uncompressed blocks are written verbatim; compressed blocks are run
through a DEFLATE decoder. Returns ZiPatchError::Decompress on a
decompression error.
Sourcepub fn decompress(&self) -> Result<Cow<'_, [u8]>>
pub fn decompress(&self) -> Result<Cow<'_, [u8]>>
Return the block’s decompressed bytes.
Uncompressed blocks return a borrow into the existing buffer with no
allocation; compressed blocks allocate and decompress into a new Vec.
Trait Implementations§
Source§impl Clone for SqpkCompressedBlock
impl Clone for SqpkCompressedBlock
Source§fn clone(&self) -> SqpkCompressedBlock
fn clone(&self) -> SqpkCompressedBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqpkCompressedBlock
impl Debug for SqpkCompressedBlock
Source§impl PartialEq for SqpkCompressedBlock
impl PartialEq for SqpkCompressedBlock
Source§fn eq(&self, other: &SqpkCompressedBlock) -> bool
fn eq(&self, other: &SqpkCompressedBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for SqpkCompressedBlock
impl StructuralPartialEq for SqpkCompressedBlock
Auto Trait Implementations§
impl Freeze for SqpkCompressedBlock
impl RefUnwindSafe for SqpkCompressedBlock
impl Send for SqpkCompressedBlock
impl Sync for SqpkCompressedBlock
impl Unpin for SqpkCompressedBlock
impl UnsafeUnpin for SqpkCompressedBlock
impl UnwindSafe for SqpkCompressedBlock
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