Skip to main content

Crate zstdscope

Crate zstdscope 

Source
Expand description

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(_)));

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

Structs§

Block
Structural metadata for one Standard Frame block.
ByteSpan
A half-open span of bytes in the original encoded input.
ContentChecksum
Stored 32-bit content checksum metadata.
DictionaryId
A physically encoded Dictionary ID and its source location.
Frame
One top-level frame in a Zstandard stream.
FrameContentSize
A decoded Frame Content Size together with the bytes that encoded it.
FrameHeader
Parsed fields and derived values from a Standard Frame Header.
InspectionLimits
Resource limits applied by crate::inspect_with_limits.
SkippableFrame
Structural metadata for a Zstandard Skippable Frame.
StandardFrame
Structural metadata for a standard Zstandard frame.
ZstdFile
Structural inspection result for the complete input slice.

Enums§

BlockType
Valid Standard Frame block types supported by the structural parser.
FrameKind
Supported top-level Zstandard frame kinds.
ResourceLimitKind
Resource category that exceeded an crate::InspectionLimits value.
ZstdError
Errors returned while structurally inspecting encoded Zstandard data.

Functions§

inspect
Inspects one or more concatenated Zstandard frames without decompressing them.
inspect_with_limits
Inspects Zstandard frames while enforcing caller-provided metadata limits.