Skip to main content

frame_decompressed_bound

Function frame_decompressed_bound 

Source
pub fn frame_decompressed_bound(src: &[u8]) -> Result<u64, FrameSizeError>
Expand description

Upper bound on the decompressed size of the FIRST frame in src, without decoding the body. Backs the C ZSTD_decompressBound (per-frame term).

Returns the exact size when the header declares Frame_Content_Size; otherwise a valid (loose) bound of block_count * block_size_max, where block_size_max = min(window_size, 128 KiB) — every block decompresses to at most that many bytes. Skippable frames contribute 0. With the legacy feature a v0.5-v0.7 frame is bounded by its blocks whatever its header declares, since those formats do not hold a frame to its declared size: 128 KiB per compressed block, as libzstd bounds it, and a stored block’s own size, which can be more.

§Errors

FrameSizeError on an unreadable header, truncation, or a reserved block.