pub fn find_decompressed_size(
src: &[u8],
) -> Result<FrameContentSize, DecompressedSizeError>Expand description
Total decompressed size the frames in src declare, without decoding any
of them: FrameContentSize::Known with the sum, skippable frames counting
zero, or FrameContentSize::Unknown as soon as one frame does not declare
its size. Backs the C ZSTD_findDecompressedSize entry point.
§Errors
DecompressedSizeError when a frame is malformed or truncated, or the
sizes overflow u64.
use structured_zstd::encoding::{compress_slice_to_vec, CompressionLevel};
use structured_zstd::decoding::{find_decompressed_size, FrameContentSize};
let mut frames = compress_slice_to_vec(&[1u8; 300], CompressionLevel::Default);
frames.extend(compress_slice_to_vec(&[2u8; 200], CompressionLevel::Default));
assert_eq!(find_decompressed_size(&frames).unwrap(), FrameContentSize::Known(500));