Skip to main content

DocsError

Enum DocsError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

Fields

§limit: u64
§actual: u64
§

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.

Fields

§part: String
§what: &'static str
§

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.

Fields

§kind: &'static str
§name: String
§

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.

Fields

§op: &'static str
§format: &'static str
§

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§

Source§

impl DocsError

Source

pub fn code(&self) -> &'static str

Stable wire code.

Trait Implementations§

Source§

impl Debug for DocsError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DocsError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DocsError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<PdfEditError> for DocsError

Source§

fn from(source: PdfEditError) -> Self

Converts to this type from the input type.
Source§

impl Serialize for DocsError

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.