Skip to main content

FidelityReport

Struct FidelityReport 

Source
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

Source

pub fn exact() -> Self

Source

pub fn new(rung: Rung) -> Self

Source

pub fn warn(&mut self, w: Fidelity)

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> FidelityReport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FidelityReport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FidelityReport

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FidelityReport

Source§

impl PartialEq for FidelityReport

Source§

fn eq(&self, other: &FidelityReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FidelityReport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.