Skip to main content

PageTreeError

Enum PageTreeError 

Source
#[non_exhaustive]
pub enum PageTreeError { NoPageTreeRoot, BadKid(ObjId), Cycle(ObjId), TooDeep, TooManyPages, MissingRequired(&'static str), BadResources, BadRectangle(&'static str), BadRotate(i64), BadContents, }
Expand description

Page-tree structural errors.

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.
§

NoPageTreeRoot

The catalog has no usable /Pages entry.

§

BadKid(ObjId)

A Kids element resolved to something that is not a dictionary (including a dangling reference’s null).

§

Cycle(ObjId)

A node was visited twice — the tree has a cycle.

§

TooDeep

Nesting exceeded MAX_TREE_DEPTH (pdfcer guard).

§

TooManyPages

More than MAX_PAGES leaves (pdfcer guard).

§

MissingRequired(&'static str)

A required inheritable attribute resolved nowhere on the path to the root (§7.7.3.4: “a value shall be supplied in an ancestor node”).

MediaBox only, since Pass 290.0. Resources used to produce this too, and it was the wrong severity for the wrong attribute: an absent resource dictionary means “no named resource is available”, which is a statement the empty dictionary makes exactly, whereas an absent MediaBox means the page has no geometry and any value pdfcer chose (Letter? A4? the previous page’s?) would be invented. Continuing requires inventing nothing; that is the line decision 145 draws, and MediaBox is on the other side of it. See Page::resources_defaulted.

§

BadResources

/Resources was present but resolved to something that is not a dictionary — a number, a name, an array, a string or a stream.

Deliberately narrower than “the attribute is unusable”: an absent /Resources, and one whose reference dangles (§7.3.10 makes that the null object; §7.3.9 makes null “equivalent to omitting the entry”), are not this error. Those degrade to the empty dictionary and are disclosed through Page::resources_defaulted. This variant is reserved for a value with no spec-sanctioned reading, which is a real structural defect and must not be laundered into a page that merely renders emptier — the same split Self::BadContents makes, for the same reason.

§

BadRectangle(&'static str)

A rectangle entry wasn’t an array of four numbers.

§

BadRotate(i64)

Rotate was not an integer multiple of 90 (Table 30 “shall”).

§

BadContents

Contents held a value of the wrong type — something that is neither a stream reference, an array of them, nor null.

Deliberately narrower than it looks: an element that resolves to null (a dangling reference to an object the file does not contain) is NOT this error. §7.3.10 defines such a reference to be the null object and Table 30 makes an absent Contents an empty page, so that case degrades — the element contributes nothing and the omission is counted in Page::contents_unresolved. This variant is reserved for values with no spec-sanctioned reading (a number, a name, a dictionary, a non-reference array element), which are real structural defects and must not be laundered into a silent blank page.

Trait Implementations§

Source§

impl Clone for PageTreeError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PageTreeError

Source§

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

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

impl Display for PageTreeError

Source§

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

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

impl Error for PageTreeError

1.30.0 · 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

Replaced by Error::source.
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 PartialEq for PageTreeError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PageTreeError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.