#[non_exhaustive]pub enum Chain {
Codec {
codec: FormatId,
inner: Box<Chain>,
},
Container {
container: FormatId,
},
Raw,
}Expand description
A resolved decode pipeline.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Codec
A codec wrapping something else. Decode order: this codec, then inner.
Container
A container of entries.
Raw
Opaque bytes. The terminal case for a bare compressed file.
Implementations§
Source§impl Chain
impl Chain
Sourcepub fn container(&self) -> Option<FormatId>
pub fn container(&self) -> Option<FormatId>
The container this chain resolves to, if any, at ANY depth.
Some(tar) for tar over gzip as well as for a bare tar: however
many codec layers sit above it, the entries live in a container, and a
caller that has not OPENED that container cannot speak for its
fidelity. That is the whole use — ops::inspect identifies a stream
WITHOUT decoding it, so it never opens the container and must not
report a fidelity conclusion it did not reach. See
ops::Inspection::fidelity_evaluated.
The _ arm covers Chain::Raw and anything added later: Chain is
#[non_exhaustive], and “no container” is the right answer for a
shape this method does not recognise, since the caller’s only use of
Some is to withhold a claim.
Sourcepub fn outermost_codec(&self) -> Option<FormatId>
pub fn outermost_codec(&self) -> Option<FormatId>
The outermost codec, if any — the layer a writer must create FIRST, because the container writes into it.
Deliberately only the outermost, and deliberately NOT recursive the
way Chain::container is: a write-side chain is at most one codec
deep. MAX_CHAIN_DEPTH bounds the READ side, where deeper nesting is
a hostile-input concern rather than a shape stuffr emits, and a
recursive answer here would let a caller silently write only the
innermost of several codecs.