pub enum Error {
Io(Error),
Opc(Error),
UnrecognizedFormat,
FormatNotEnabled(&'static str),
Word(Error),
Excel(Error),
Powerpoint(Error),
}Expand description
Errors from office-toolkit’s own file-level convenience layer.
Variants§
Io(Error)
An I/O error occurred opening/reading/writing the file itself.
Opc(Error)
An error occurred at the OPC package level while inspecting a file
to detect its format (crate::open) — before it’s even clear
which format-specific reader should take over.
UnrecognizedFormat
The file is a well-formed OPC/ZIP package, but carries none of the
three main parts (word/document.xml/xl/workbook.xml/
ppt/presentation.xml) crate::open knows how to recognize —
either a format outside this crate’s scope, or a corrupt/foreign
package. Detection never looks at the file’s name/extension, only
at the package’s own parts, so this is never a false negative
caused by a missing/wrong extension.
FormatNotEnabled(&'static str)
crate::open recognized the file’s format from its parts, but
the matching Cargo feature (word/excel/powerpoint) isn’t
enabled in this build, so no reader is available for it. Distinct
from Error::UnrecognizedFormat — the file is a perfectly valid
Office document, this build just wasn’t compiled to handle it.
Word(Error)
A .docx was recognized (or explicitly requested via
crate::OpenFile/crate::SaveToFile), but word-ooxml itself
failed to read or write it.
Excel(Error)
A .xlsx was recognized (or explicitly requested via
crate::OpenFile/crate::SaveToFile), but excel-ooxml itself
failed to read or write it.
Powerpoint(Error)
A .pptx was recognized (or explicitly requested via
crate::OpenFile/crate::SaveToFile), but powerpoint-ooxml
itself failed to read or write it.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()