pub struct FidelityReport {
pub rung: Rung,
pub warnings: Vec<Fidelity>,
}Expand description
What a read cost in fidelity. Returned alongside data, never logged and discarded — the caller must be able to discover what was approximated.
Fields§
§rung: Rung§warnings: Vec<Fidelity>Implementations§
Source§impl FidelityReport
impl FidelityReport
pub fn exact() -> Self
pub fn new(rung: Rung) -> Self
pub fn warn(&mut self, w: Fidelity)
Sourcepub fn has_warnings(&self) -> bool
pub fn has_warnings(&self) -> bool
Whether anything was approximated. This is the --strict-fidelity
gate (exit code 4).
Gating on warnings rather than on the rung is deliberate: a tar read
from a pipe lands on ForwardOnly, but tar has no trailing index, so
nothing was lost. Failing it would hand a script an error it cannot act
on. The rung stays diagnostic — reported by stuffr info.
Sourcepub fn is_lossless(&self) -> bool
pub fn is_lossless(&self) -> bool
True only if the rung was authoritative and nothing was approximated.
Deliberately not the --strict-fidelity gate — see
Self::has_warnings. This is the stronger “the format’s own index was
read and nothing was lost” claim, useful for archival verification.
Sourcepub fn merge(&mut self, other: &FidelityReport)
pub fn merge(&mut self, other: &FidelityReport)
Fold another report in: worst rung wins, warnings are unioned.
For combining reports from independently-resolved layers — e.g. a
codec’s own report merged with the inner container’s, once a chain has
more than one — rather than for a single container’s own findings,
which it now records by calling Self::warn directly on the report
it inherited from the ladder (see [crate::ladder::seed_report]). A
warning already present is not repeated, so folding the same loss in
from two sources still tells the caller about it once.
Trait Implementations§
Source§impl Clone for FidelityReport
impl Clone for FidelityReport
Source§fn clone(&self) -> FidelityReport
fn clone(&self) -> FidelityReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more