#[non_exhaustive]pub enum DetectError {
NotZip,
MissingManifest,
Zip(String),
Inconsistent(String),
Io(Error),
}Expand description
Failures that stop classify before a Classification.
Does not implement PartialEq — match with matches! rather than
comparing, or compare the Display output.
use odf_crypto::{classify, DetectError};
let err = classify(b"this is not a zip file").unwrap_err();
assert!(matches!(err, DetectError::NotZip));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotZip
The bytes are not a zip archive at all.
MissingManifest
A zip, but with no META-INF/manifest.xml, so not an ODF package.
Zip(String)
A zip entry could not be read. The string is a diagnostic; do not match on its content.
Inconsistent(String)
The package is one LibreOffice itself would not open — a duplicate or invalid entry name, or a stream/folder collision.
The string is a diagnostic; do not match on its content. It may quote
package-controlled text — the mimetype member and manifest:media-type
both appear in the mimetype-conflict case — so treat it as untrusted
when logging or displaying it. Each quoted value is elided to 96 bytes,
which bounds the message but does not make its content trustworthy.
Io(Error)
The caller’s reader failed a read or a seek, so nothing can be said
about the package. Only crate::classify_reader returns it: a slice
cannot fail a read.
The error is the reader’s own value, so a caller can recognize its own
cancellation in it. It wins over the zip layer’s interpretation of the
same failure; see classify_reader.
Trait Implementations§
Source§impl Debug for DetectError
impl Debug for DetectError
Source§impl Display for DetectError
impl Display for DetectError
Source§impl Error for DetectError
impl Error for DetectError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<DetectError> for DecryptError
Available on crate feature crypto-ops only.
impl From<DetectError> for DecryptError
crypto-ops only.Source§fn from(source: DetectError) -> Self
fn from(source: DetectError) -> Self
Source§impl From<DetectError> for EncryptError
Available on crate feature crypto-ops only.
impl From<DetectError> for EncryptError
crypto-ops only.Source§fn from(source: DetectError) -> Self
fn from(source: DetectError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for DetectError
impl !UnwindSafe for DetectError
impl Forget for DetectError
impl Freeze for DetectError
impl Move for DetectError
impl Send for DetectError
impl Sync for DetectError
impl Unpin for DetectError
impl UnsafeUnpin for DetectError
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more