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.
- Byte
Span - A half-open span of bytes in the original encoded input.
- Content
Checksum - Stored 32-bit content checksum metadata.
- Dictionary
Id - A physically encoded Dictionary ID and its source location.
- Frame
- One top-level frame in a Zstandard stream.
- Frame
Content Size - A decoded Frame Content Size together with the bytes that encoded it.
- Frame
Header - Parsed fields and derived values from a Standard Frame Header.
- Inspection
Limits - Resource limits applied by
crate::inspect_with_limits. - Skippable
Frame - Structural metadata for a Zstandard Skippable Frame.
- Standard
Frame - Structural metadata for a standard Zstandard frame.
- Zstd
File - Structural inspection result for the complete input slice.
Enums§
- Block
Type - Valid Standard Frame block types supported by the structural parser.
- Frame
Kind - Supported top-level Zstandard frame kinds.
- Resource
Limit Kind - Resource category that exceeded an
crate::InspectionLimitsvalue. - Zstd
Error - 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.