Skip to main content

SaveOptions

Struct SaveOptions 

Source
#[non_exhaustive]
pub struct SaveOptions { pub producer: ProducerPolicy, pub xref_entry_eol: XrefEntryEol, pub trailing_eol: TrailingEol, pub edited_stream_compression: EditedStreamCompression, }
Expand description

Options controlling a save.

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.
§producer: ProducerPolicy

/Producer handling for save_full. Ignored by save_incremental, which never touches /Info.

§xref_entry_eol: XrefEntryEol

Which of §7.5.4’s three permitted two-byte terminators ends a classic cross-reference entry (spec ambiguity EOL-A1, R169).

Default XrefEntryEol::SpaceLf — the form pdfcer has always emitted. Evidence tier (c), downgrade pending: the spec RAG calls SP LF “the common choice” but the register’s §11.3 flags that the claim carries no citation and should either gain one or drop to tier (d).

Applies to newly written cross-reference entries only, so an incremental save changes nothing about the base revision’s bytes.

§trailing_eol: TrailingEol

Whether an end-of-line byte follows the final %%EOF (spec ambiguity EOL-A2, R169).

Default TrailingEol::Lf — what pdfcer has always emitted. Evidence tier (d), a reasoned guess and the safe side of one: §7.2.3 needs an EOL before a following N G obj on the append path anyway, and a trailing EOL never breaks a backward %%EOF scan.

§edited_stream_compression: EditedStreamCompression

How an edited stream whose source was /FlateDecode is written.

Default EditedStreamCompression::KeepSourceFilter: edit routes stage decoded bytes, so without this a 1.6 MB compressed content stream is saved as 14 MB of plain text.

Implementations§

Source§

impl SaveOptions

Source

pub fn identity() -> Self

Options that leave every byte pdfcer did not have to change exactly as it was — the settings the round-trip harness and the per-object byte-identity gate run under.

The two §7.5 end-of-line knobs stay at their defaults here rather than tracking the operator’s persisted choice, and that is deliberate: identity() names a byte-comparison posture, and a harness whose expected bytes depend on a settings file is a harness that fails on one machine and passes on another. An operator-facing save path applies the persisted values explicitly; this one does not, and says so.

Source

pub const fn with_edited_stream_compression( self, c: EditedStreamCompression, ) -> Self

Set how an edited, formerly Flate-compressed stream is written, consuming and returning self.

Source

pub const fn with_xref_entry_eol(self, eol: XrefEntryEol) -> Self

Set the classic cross-reference entry terminator (EOL-A1), consuming and returning self.

BYTES blast radius. Every value §7.5.4 permits is conforming, so this changes bytes and nothing else; it exists so an operator matching another tool’s output byte-for-byte can.

Source

pub const fn with_trailing_eol(self, eol: TrailingEol) -> Self

Set whether a trailing end-of-line follows %%EOF (EOL-A2), consuming and returning self.

Source

pub const fn with_producer(self, producer: ProducerPolicy) -> Self

Set the /Producer policy, consuming and returning self.

A setter rather than a struct-literal field because SaveOptions is #[non_exhaustive]: downstream crates (pdfcer, pdfce-gui, the round-trip harness) cannot use a struct expression at all, and adding an option in a later Pass must not be a breaking change for them.

Trait Implementations§

Source§

impl Clone for SaveOptions

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 SaveOptions

Source§

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

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

impl Default for SaveOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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.