#[non_exhaustive]pub enum MalformedDetail {
Truncated,
LengthOutOfRange,
MissingMarker,
UnexpectedMarker,
BrokenIndex,
CyclicReference,
UnsupportedFeature,
NotRoundTrippable,
DependencyPanic,
}Expand description
Which structural rule a malformed file broke.
Deliberately coarse. The purpose is to let a user tell “this file is truncated” from “this file is not really the format it claims”, not to provide a parser trace.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated
The file ends in the middle of a structure that declared more bytes.
LengthOutOfRange
A length or offset field points outside the file.
MissingMarker
A required structural marker is missing.
UnexpectedMarker
A structural marker appeared where it is not permitted.
BrokenIndex
The cross-reference or index structure is unusable.
CyclicReference
The file’s objects reference each other in a cycle.
UnsupportedFeature
The file uses a feature strypt will not process, such as encryption.
NotRoundTrippable
The rewritten file did not read back as the document that was written.
Distinct from every other variant here because it describes a failure found in strypt’s output rather than in the input: the document parsed, scrubbed, and serialised, and the result then did not round-trip. The input is still what caused it — a structure lenient enough to parse but not to reproduce — so it belongs with the malformed refusals rather than being reported as an internal error, which would tell the user to file a bug about a file that is genuinely broken.
DependencyPanic
A third-party parser panicked on this file and the panic was contained.
Reported as malformed input rather than as an internal error because that is what it
means for the user: the file was not processed and nothing was written. It is a
distinct variant rather than being folded into BrokenIndex because a panic in a
dependency is a defect worth being able to find in the wild, not an ordinary refusal
(crate::panic_guard).
Trait Implementations§
Source§impl Clone for MalformedDetail
impl Clone for MalformedDetail
Source§fn clone(&self) -> MalformedDetail
fn clone(&self) -> MalformedDetail
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MalformedDetail
Source§impl Debug for MalformedDetail
impl Debug for MalformedDetail
Source§impl Display for MalformedDetail
impl Display for MalformedDetail
impl Eq for MalformedDetail
Source§impl PartialEq for MalformedDetail
impl PartialEq for MalformedDetail
impl StructuralPartialEq for MalformedDetail
Auto Trait Implementations§
impl Freeze for MalformedDetail
impl RefUnwindSafe for MalformedDetail
impl Send for MalformedDetail
impl Sync for MalformedDetail
impl Unpin for MalformedDetail
impl UnsafeUnpin for MalformedDetail
impl UnwindSafe for MalformedDetail
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.