pub struct Update<'a> { /* private fields */ }Expand description
A base document plus the update section being built over it.
Implementations§
Source§impl<'a> Update<'a>
impl<'a> Update<'a>
Sourcepub fn new(doc: &'a Document) -> Result<Update<'a>>
pub fn new(doc: &'a Document) -> Result<Update<'a>>
Opens doc for an update: refuses an encrypted base or one missing
/Root or a startxref to chain the appended section’s /Prev to.
Sourcepub fn set(&mut self, r: ObjRef, obj: Object)
pub fn set(&mut self, r: ObjRef, obj: Object)
Sets an object under its own number, whether new or a replacement of one already in the base.
Sourcepub fn remove(&mut self, r: ObjRef)
pub fn remove(&mut self, r: ObjRef)
Marks r free in the appended section’s cross-reference data.
Sourcepub fn reserve(&mut self) -> ObjRef
pub fn reserve(&mut self) -> ObjRef
Allocates the next free object number without storing anything under it yet.
Sourcepub fn set_metadata(&mut self, meta: Metadata) -> Result<()>
pub fn set_metadata(&mut self, meta: Metadata) -> Result<()>
Merges meta into the base document’s /Info dictionary: the ref
comes from the overlay’s own info ref when a prior call set one,
else the base’s; the dictionary itself always comes from the base
document (never from a prior call’s staged fields, so two calls on
one Update do not compound; on a base without /Info, a call
starts from a fresh dictionary). When the catalog already names an
XMP packet, it is rewritten from the merged fields. See
set_metadata_with for the merge and rewrite rules.
Sourcepub fn append_into(&self, out: impl Write) -> Result<()>
pub fn append_into(&self, out: impl Write) -> Result<()>
Writes the base bytes, a pad newline when the base needs one, and
the appended section into out. The section is built before any
byte reaches out, so a refused update (or any other failure)
writes nothing at all.