Skip to main content

RecoveryReport

Struct RecoveryReport 

Source
#[non_exhaustive]
pub struct RecoveryReport { pub reason: RecoveryReason, pub file_level_objects: usize, pub objstm_objects: usize, pub last_wins_collisions: usize, pub stream_lengths_recovered: usize, pub missing_endobj_recovered: usize, pub objects_dropped: Vec<DroppedObject>, pub trailer_source: TrailerSource, pub offset_start: bool, }
Expand description

The counted, disclosed record of a recovery (fuzzy-never-sneaky, R20).

Stored on the recovered crate::document::Document; surfaced by the CLI (a diagnostic line + a distinct exit status) and the GUI (a non-blocking banner). Every field is a fact an operator can act on, so none is rounded away.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§reason: RecoveryReason

Why the strict load failed (the originating cause).

§file_level_objects: usize

Objects recovered by the file-level N G obj scan (type-1).

§objstm_objects: usize

Objects recovered from /Type /ObjStm containers (type-2).

§last_wins_collisions: usize

Duplicate object numbers resolved last-valid-wins among file-level definitions (how many times a number had more than one valid definition).

§stream_lengths_recovered: usize

Recovered objects whose stream extent had to be re-derived from the endstream keyword because the stored /Length was unusable (absent, unresolvable, or simply not landing on endstream — §7.3.8.2 defines /Length in terms of that keyword, so the two are halves of one statement and this counts how often they disagreed).

Counted over the objects actually kept, not over every candidate examined, so the number matches what the loaded document contains. A non-zero value means some stream’s byte extent is pdfcer’s reading of the file rather than the file’s own claim — the operator is told (R20) because the two can differ, most visibly for a stream whose binary data happens to contain the bytes endstream.

§missing_endobj_recovered: usize

How many definitions were accepted with no endobj keyword (§7.3.10 requires one).

Non-zero means the file omitted a required terminator and pdfcer bounded the object at the next N G obj header instead of dropping it. Dropping is what pdfcer used to do, and it is how a document whose catalog named an absent /Pages object got written — see crate::parser::TerminatorPolicy. Disclosed, never silent (R20).

§objects_dropped: Vec<DroppedObject>

Objects the scan FOUND — a well-formed N G obj header at a byte offset — and recovery could not keep, with the reason for each.

§Why this is a list and not a count (decision 145, owed item 18)

decision 145 obliges pdfcer to disclose what it dropped rather than return a shorter document and no explanation. It closed that gap at the loader; the recovery path had the same gap and was measured having it on a real file: Annotations_output.pdf, whose startxref points 134 bytes short of its own xref (a PDFsharp writer bug), recovers 10 of 11 objects and drops object 5 — the page’s content stream — with nothing recorded anywhere.

Losing that object is the CORRECT outcome: its Flate data is genuinely corrupt and keeping it would hand a caller bytes that cannot be decoded. Losing it silently is not, and the difference is the whole of rule 4 — an inference pdfcer made (this candidate is not usable) is disclosed, never silent.

A COUNT would not have been enough, and that is why this carries the object number and the reason. The complaint that produced this item was not “the number was wrong” — it was that a human holding a file with a missing page could not find out WHICH object went or WHY. A bare dropped: 1 answers neither.

§trailer_source: TrailerSource

Where the recovered trailer’s keys came from.

§offset_start: bool

Whether the %PDF- marker was not at byte 0 (offset-start / leading-junk / headerless) — recovery handled it via absolute offsets with no rebasing.

Trait Implementations§

Source§

impl Clone for RecoveryReport

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 RecoveryReport

Source§

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

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

impl Eq for RecoveryReport

Source§

impl PartialEq for RecoveryReport

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 RecoveryReport

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