pub struct Compression {
pub codec: Codec,
pub uncompressed_size: u64,
pub shuffle_item_size: Option<u64>,
pub subblocks: Vec<(u64, u64)>,
}Expand description
A parsed compression attribute.
Fields§
§codec: Codec§uncompressed_size: u64The size the block decompresses to. The spec requires it, so a decoder never has to guess how much to allocate.
shuffle_item_size: Option<u64>Element size for byte unshuffling, or None when not shuffled.
Shuffling stores all the first bytes of each element, then all the second bytes, and so on, which makes the codecs’ job much easier on numeric data. An item size of 1 is a no-op and the spec forbids it as a shuffled form.
subblocks: Vec<(u64, u64)>Compression subblocks, as (compressed, uncompressed) byte counts.
Empty means the block is one compressed stream, which is the ordinary case. When present, the stored bytes are that many independent streams laid end to end, each decompressing to its own length – so a decoder that fed the whole buffer to one codec call would recover only the first subblock.
They exist because codecs have input limits – zlib cannot compress more than 4GiB at once – and because splitting a block lets an encoder compress the pieces in parallel.
Implementations§
Trait Implementations§
Source§impl Clone for Compression
impl Clone for Compression
Source§fn clone(&self) -> Compression
fn clone(&self) -> Compression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more