Skip to main content

Fidelity

Enum Fidelity 

Source
#[non_exhaustive]
pub enum Fidelity { TrailingIndexUnread { format: FormatId, }, SizeFromDataDescriptor { entry: String, }, EntryCountUnknown, EntryCountMismatch { format: FormatId, declared: u64, enumerated: u64, reason: String, }, MetadataIncomplete { entry: String, fields: MetaFields, }, SolidBlockFullyDecoded { wasted_bytes: u64, }, EncryptedEntrySkipped { entry: String, }, EntrySkipped { entry: String, reason: String, }, EntrySizeChanged { entry: String, declared: u64, fixup: String, }, TruncatedStream { at: u64, }, }
Expand description

One specific, structured thing that was lost or approximated.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TrailingIndexUnread

Fields

§format: FormatId
§

SizeFromDataDescriptor

Fields

§entry: String
§

EntryCountUnknown

§

EntryCountMismatch

The archive’s own index declares more records than the reader was able to enumerate, so entries exist in the file that no caller can reach.

Distinct from Self::EntryCountUnknown, which is the forward reader admitting it never saw a count at all. Here the count WAS read, from the format’s authoritative structure, and it disagrees with what came back — the strongest evidence available that a read is incomplete, and the one a seekable Rung::Exact read would otherwise have no way to express. Without it a partial enumeration is indistinguishable from a complete one, which is the failure this variant exists to prevent: listing six of eight records and calling it exact fidelity.

Raised, not recovered. Reaching the shadowed records would mean re-parsing the index by hand; naming the shortfall is what the caller needs in order to know not to trust the result, and --strict-fidelity turns it into exit 4.

reason is an owned String for the same reason Self::EntrySkipped’s is: the cause is specific to the container and the reader, and a shortfall that cannot say WHY is one the user cannot act on.

Fields

§format: FormatId
§declared: u64

What the archive’s own index says it holds.

§enumerated: u64

What the reader was actually able to enumerate.

§reason: String

Why the two differ, in terms the caller can act on.

§

MetadataIncomplete

Fields

§entry: String
§fields: MetaFields
§

SolidBlockFullyDecoded

Fields

§wasted_bytes: u64
§

EncryptedEntrySkipped

Fields

§entry: String
§

EntrySkipped

An entry this build cannot materialise, named along with why.

Distinct from Self::MetadataIncomplete, which is about an entry that WAS written and lost some of its metadata: here the entry itself is absent from the result. Extraction raises it for a device node, fifo, socket or hardlink — crate::EntryKind::Other, the honest answer a container gives for an entry shape EntryKind has no variant for yet. Writing one out as a regular file carrying its “contents” would be a silent lie about what the archive held. The write side raises it too, for something met on disk that no container here can store — a socket, an undecodable name, a directory being packed into ar.

reason is an owned String rather than a &'static str because the write side’s reasons carry runtime detail — the failing errno, the container’s own name, the undecodable bytes — and a reason that cannot name the particular thing that went wrong is a reason the user cannot act on.

Fields

§entry: String
§reason: String
§

EntrySizeChanged

A file that changed length between the moment its size was recorded and the moment its bytes were read, stored at the length its header already declares.

Distinct from Self::EntrySkipped: the entry IS in the archive, and the archive is structurally valid. What was lost is the tail of a file that grew, or the tail of a file that shrank — replaced by zeros, because the entry header was written before the payload was read and a container cannot un-write it. Refusing instead would throw away the whole archive over one file that a live system happened to touch, which is what pack ~ -o backup.tar over a running home directory does routinely; GNU tar prints file changed as we read it and continues, and this is the same bargain, with the loss named rather than printed and forgotten.

--strict-fidelity still refuses on it, which is the half of the bargain that keeps it honest.

Fields

§entry: String
§declared: u64

The length written into the entry header, from the walk’s stat.

§fixup: String

What the file actually supplied and what was done about it.

Prose rather than a second u64 because the two directions know different things: a file that shrank supplies an exact count, while a file that grew is only known to have had more — measuring how much more would mean reading a tail that is deliberately not being stored. A field that could name the figure in one case and not the other would have to lie in one of them.

§

TruncatedStream

Fields

§at: u64

Trait Implementations§

Source§

impl Clone for Fidelity

Source§

fn clone(&self) -> Fidelity

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 Fidelity

Source§

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

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

impl Display for Fidelity

Source§

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

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

impl Eq for Fidelity

Source§

impl Error for Fidelity

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for Fidelity

Source§

fn eq(&self, other: &Fidelity) -> 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 Fidelity

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.