#[non_exhaustive]pub enum ZipInconsistency {
HeaderMismatch {
entry: ZipEntryIndex,
field: ZipHeaderField,
name: String,
},
DuplicateName {
record: CentralRecordOrdinal,
name: String,
},
OverlappingEntries,
HiddenLocalHeader {
offset: u64,
region: HiddenRegion,
},
IgnoredEndRecord {
offset: u64,
},
StrayCentralRecord {
offset: u64,
},
StrayEndRecord {
offset: u64,
kind: EndRecordKind,
},
DescriptorOverrun {
entry: ZipEntryIndex,
offset: u64,
},
XlTypeDivergence {
entry: ZipEntryIndex,
offset: u64,
},
UncountedCentralRecords {
counted: usize,
found: usize,
},
HeaderUncomparable {
entry: ZipEntryIndex,
name: String,
reason: ZipUncomparable,
},
}Expand description
A structural finding that makes a ZIP archive ambiguous between readers.
Names are the raw central directory bytes decoded lossily; the zip
crate’s own key can differ after Unicode Path substitution.
§Examples
use exarch_core::CentralRecordOrdinal;
use exarch_core::ZipInconsistency;
let finding = ZipInconsistency::DuplicateName {
record: CentralRecordOrdinal::new(1),
name: "a.txt".to_string(),
};
assert_eq!(
finding.to_string(),
"duplicate entry name \"a.txt\" (record 1)"
);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HeaderMismatch
A local header disagrees with its central directory record.
Fields
entry: ZipEntryIndexEntry in the crate’s entry map.
field: ZipHeaderFieldField that differs.
DuplicateName
Two or more central directory records share a name.
Fields
record: CentralRecordOrdinalPosition in the raw central directory of a record that the zip
crate collapsed into a later record with the same name.
OverlappingEntries
Entry data ranges intersect.
HiddenLocalHeader
A local header exists that no central directory record maps.
Fields
region: HiddenRegionPart of the file the header was found in.
IgnoredEndRecord
An end of central directory record other than the one the reader used follows it, so a reader that picks another candidate sees another directory.
StrayCentralRecord
A central directory record sits outside the central directory, in the bytes before the first entry or between entries, so a streaming reader that stops listing at the first central record never sees the entries after it.
StrayEndRecord
An end record signature sits in the bytes before the first entry or between entries, so a streaming reader that stops listing at it never sees the entries after it.
Fields
kind: EndRecordKindKind of end record the signature starts.
DescriptorOverrun
A data descriptor makes a streaming reader resume past the next entry header, so it skips or misreads that entry.
Fields
entry: ZipEntryIndexEntry whose descriptor is misread.
XlTypeDivergence
An xl extra field, in the local header or the central record, gives
an entry a file type that differs from the one its central attributes
give, so a reader that honours the field extracts another kind of entry
than one that follows the attributes.
Fields
entry: ZipEntryIndexEntry whose types differ.
UncountedCentralRecords
The central directory holds more records than its end record counts.
Fields
HeaderUncomparable
A local header could not be compared with its central directory record, so a disagreement between them cannot be ruled out.
Fields
entry: ZipEntryIndexEntry in the crate’s entry map.
reason: ZipUncomparableWhy the comparison was not possible.
Trait Implementations§
Source§impl Clone for ZipInconsistency
impl Clone for ZipInconsistency
Source§impl Debug for ZipInconsistency
impl Debug for ZipInconsistency
Source§impl Display for ZipInconsistency
impl Display for ZipInconsistency
impl Eq for ZipInconsistency
Source§impl PartialEq for ZipInconsistency
impl PartialEq for ZipInconsistency
impl StructuralPartialEq for ZipInconsistency
Auto Trait Implementations§
impl Freeze for ZipInconsistency
impl RefUnwindSafe for ZipInconsistency
impl Send for ZipInconsistency
impl Sync for ZipInconsistency
impl Unpin for ZipInconsistency
impl UnsafeUnpin for ZipInconsistency
impl UnwindSafe for ZipInconsistency
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.