zstdscope 0.1.0

A pure Rust parser and inspection toolkit for the Zstandard compressed data format.
Documentation
  • Coverage
  • 100%
    86 out of 86 items documented1 out of 1 items with examples
  • Size
  • Source code size: 92.8 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.1 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tappe9/zstdscope
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tappe9

Structural inspection for encoded Zstandard data.

ZstdScope parses one or more concatenated Zstandard Standard or Skippable Frames and returns inspection-oriented metadata without decompressing block contents. Public source locations are expressed as zero-based byte offsets into the original encoded input.

Example

use zstdscope::{FrameKind, ZstdError, inspect};

// Minimal Standard Frame: magic, non-single-segment header, and one empty
// Raw block marked as the last block.
let bytes = [
    0x28, 0xB5, 0x2F, 0xFD, // Standard Frame magic
    0x00, 0x00,             // descriptor + Window Descriptor
    0x01, 0x00, 0x00,       // empty Raw block, Last_Block = true
];

let file = inspect(&bytes)?;
assert_eq!(file.input_size, 9);
assert_eq!(file.frames.len(), 1);
assert!(matches!(file.frames[0].kind, FrameKind::Standard(_)));
# Ok::<(), ZstdError>(())

The parser is strict: empty input, malformed structures, unknown top-level magic values, and trailing partial frames return [ZstdError] rather than being silently ignored.