#[non_exhaustive]pub enum PdfError {
Io(Error),
MissingHeader {
searched: usize,
},
MalformedVersion {
found: String,
},
}Expand description
Errors that can arise from the Pass 0 header-probe surface.
Marked #[non_exhaustive] so that later Passes can add variants
(tokenizer errors, xref errors, decryption failures, …) without it
being a breaking change for downstream consumers such as pdfcer.
Consumers matching on this enum must therefore include a wildcard arm.
Follows the Rust API Guidelines (C-GOOD-ERR): every variant is
Send + Sync + 'static and the type implements std::error::Error
via thiserror.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
The underlying file could not be read (not found, permission
denied, an I/O failure mid-read, …). Carries the source
std::io::Error.
MissingHeader
No %PDF- marker was found within the first
HEADER_SCAN_WINDOW bytes — the input is not a PDF (or is
damaged beyond recognition at its head). searched reports how
many bytes were actually inspected (may be fewer than the window
for a short file).
MalformedVersion
A %PDF- marker was found but the bytes after it were not a
parseable M.N version number. found is a lossy-UTF-8 snapshot
of the offending bytes, for diagnostics.
Trait Implementations§
Source§impl Error for PdfError
impl Error for PdfError
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()