pub struct ContainerCaps {
pub read: bool,
pub write: bool,
pub forward_parse: bool,
pub degraded_parse: bool,
pub trailing_index: bool,
pub solid: bool,
pub per_entry_codec: bool,
pub needs_seek: bool,
pub stores_dirs: bool,
pub stores_symlinks: bool,
pub detects_corruption: CorruptionDetection,
pub salvage: bool,
}Expand description
What a container can do, and what it needs from its input.
Fields§
§read: bool§write: bool§forward_parse: boolEntries can be enumerated from a forward-only source at full data fidelity (metadata may be approximate). True for zip, tar, cpio.
degraded_parse: boolOnly a best-effort salvage scan is possible forward-only. Distinct from
forward_parse: this rung yields partial results by construction.
trailing_index: boolThe authoritative index lives at the end of the stream (zip, 7z, rar).
solid: boolEntries share codec state, so reaching entry N decodes 1..N (7z, rar).
per_entry_codec: boolEach entry carries its own codec (zip, 7z).
needs_seek: boolRandom access is required even to enumerate (squashfs, iso).
stores_dirs: boolA directory can be recorded AS a directory, rather than as an empty regular file that happens to share its name.
ar is the counter-example and the reason this field exists: its
format has no directory concept at all, so writing one produces a
zero-byte file named proj/sub — after which an entry named
proj/sub/a.txt cannot be extracted, because its parent is a file.
A writer that cannot store the kind is expected to be told so by its
caller and warn, rather than emit the lie.
stores_symlinks: boolA symlink can be recorded as a link, target and all, rather than as a regular file carrying the target text as its contents.
detects_corruption: CorruptionDetectionWhether reading an archive of this format will NOTICE a corrupted
byte rather than silently returning wrong data — and, where it does,
what kind of guarantee that is. The container-side twin of
CodecCaps::detects_corruption, reusing the same enum and the same
three meanings.
Read by the read-only conformance harness’s corruption property, and
it is the reason that property is honest rather than merely strict:
the harness flips the fixture’s middle byte and demands the read-back
differ from the expectation, which a container with no integrity
check at all cannot promise. A fixture whose midpoint lands in a
reserved, comment or padding field no reader consults would fail a
CORRECT container, and the module’s own rule is that properties skip
on evidence, never on trust — ContainerCaps being one of the two
admissible kinds of evidence.
Defaults to CorruptionDetection::Never via Self::read_only,
Self::read_write and Default, so a container claims this the
same way it claims every other capability here: explicitly. lha
(CRC-16 per entry) and arj (CRC-32 per entry) are the first two to
declare it.
salvage: boolstuffr salvage has a scanner for this container: it can scan a
damaged archive for entries, report what it proved about each, and
write what it recovered.
The one answer to “is salvage supported”, read by stuffr formats’
SALVAGE column and by stuffr::entries::salvage, which refuses a
container saying false at exit 3 before scanning a byte. It is NOT
the dispatch: the facade still maps a format to its scanner by name,
and a test there pins the two to each other for every container a
build registers, in both directions.
It says nothing about how much a recovered entry can be trusted —
that is a per-format class of evidence
(crate::salvage::Attestation), owned beside the scanner dispatch.
Defaults to false via Self::read_only, Self::read_write and
Default, like every other capability here: a container claims it
explicitly, in the same commit that wires its scanner.
Implementations§
Source§impl ContainerCaps
impl ContainerCaps
Sourcepub const fn read_only() -> Self
pub const fn read_only() -> Self
A container that can be read but not written — RAR, whose compressor is proprietary.
Sourcepub const fn read_write() -> Self
pub const fn read_write() -> Self
A container supporting both directions. Every other capability stays false — a constructor must not claim what a format has not.