#[non_exhaustive]pub enum DocsError {
Show 18 variants
UnsupportedFormat(String),
MacroEnabled(String),
Encrypted,
TooLarge {
limit: u64,
actual: u64,
},
ArchiveLimit(String),
Malformed(String),
ForbiddenXml {
part: String,
what: &'static str,
},
SourceChanged,
TargetExists,
TargetMissing,
NotFound {
kind: &'static str,
name: String,
},
InvalidOp(String),
UnsafeFormula(String),
WrongFormat {
op: &'static str,
format: &'static str,
},
Pdf(PdfEditError),
PdfExtract(String),
Io(String),
SavedWithWarning(String),
}Expand description
Everything read and write can refuse. Every variant has a stable DocsError::code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsupportedFormat(String)
The bytes are not a DOCX, XLSX or PDF (legacy OLE .doc/.xls, PPTX, XLSB, plain text…).
MacroEnabled(String)
A macro-enabled package (.docm, .xlsm, .dotm, .xltm, or any package holding a VBA
project). Refused, never opened, never run.
Encrypted
Password-protected: an encrypted OOXML container, a zip-level encrypted entry, or an encrypted PDF. This crate does not decrypt.
TooLarge
The input exceeds the compressed-size cap.
ArchiveLimit(String)
A zip-bomb guard fired: entry count, decompressed size, or compression ratio.
Malformed(String)
The structure is not a valid package or part, or it contradicts itself (duplicate entries, unsafe entry names, truncated archive, broken XML).
ForbiddenXml
A DOCTYPE or entity declaration. XML external entities are not supported and the part is refused rather than parsed.
SourceChanged
The target differs from the file the edit was based on.
TargetExists
create over an existing file without overwrite.
TargetMissing
An edit op on a target that does not exist.
NotFound
A named sheet, page, range or text was not found.
InvalidOp(String)
The op itself is invalid (bad cell address, empty find string, too-long string…).
UnsafeFormula(String)
A formula the policy refuses: external workbook link, DDE, network fetch function.
WrongFormat
The op does not apply to this format.
Pdf(PdfEditError)
A rightkit-pdf refusal; the PDF wire code is in the message.
PdfExtract(String)
PDF text extraction failed.
Io(String)
Reading the source or writing the target failed. Nothing was published.
SavedWithWarning(String)
The replacement was written but a step after it failed (directory sync); treat the file as saved, durability across power loss as not established.
Implementations§
Trait Implementations§
Source§impl Error for DocsError
impl Error for DocsError
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<PdfEditError> for DocsError
impl From<PdfEditError> for DocsError
Source§fn from(source: PdfEditError) -> Self
fn from(source: PdfEditError) -> Self
Auto Trait Implementations§
impl Freeze for DocsError
impl RefUnwindSafe for DocsError
impl Send for DocsError
impl Sync for DocsError
impl Unpin for DocsError
impl UnsafeUnpin for DocsError
impl UnwindSafe for DocsError
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.