pub struct PendingBlock {
pub data: Vec<u8>,
pub compression: Compression,
pub allocated_size: u64,
pub already_compressed: bool,
pub uncompressed_size: u64,
}Expand description
A block queued for writing.
Fields§
§data: Vec<u8>The data, uncompressed unless PendingBlock::already_compressed is
set.
compression: CompressionHow to compress it on the way out, or how it is already compressed.
allocated_size: u64Space to reserve, which may exceed the used size so the block can grow later without moving everything after it. Zero means “use the used size”.
already_compressed: booldata already holds compressed bytes, to be written verbatim.
This is how a block is copied from one file to another without a decompress/recompress round trip, which would be wasteful and could not reproduce the original bytes.
uncompressed_size: u64The uncompressed size, needed only when Self::already_compressed
is set: it is what the header must record and cannot be measured from
the bytes at hand.
Implementations§
Source§impl PendingBlock
impl PendingBlock
Sourcepub fn compressed(data: Vec<u8>, compression: Compression) -> Self
pub fn compressed(data: Vec<u8>, compression: Compression) -> Self
A block compressed with the given method.
Sourcepub fn precompressed(
data: Vec<u8>,
compression: Compression,
uncompressed_size: u64,
) -> Self
pub fn precompressed( data: Vec<u8>, compression: Compression, uncompressed_size: u64, ) -> Self
A block whose bytes are already compressed, written verbatim.
uncompressed_size is what the data decompresses to; the header
records it and a reader needs it to size its output buffer.
Trait Implementations§
Source§impl Clone for PendingBlock
impl Clone for PendingBlock
Source§fn clone(&self) -> PendingBlock
fn clone(&self) -> PendingBlock
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more