Skip to main content

Update

Struct Update 

Source
pub struct Update<'a> { /* private fields */ }
Expand description

the changes to one document, written by save() as an incremental update

Implementations§

Source§

impl Update<'_>

Source

pub fn set_fonts(&mut self, fonts: Rc<dyn FontSource>)

where fallback fonts come from (SystemFonts by default)

Source

pub fn set_lang(&mut self, lang: &str)

the language of Han characters in values (zh-Hans, zh-Hant, ja, ko; else the document’s /Lang)

Source

pub fn set_field( &mut self, name: &str, value: FieldValue<'_>, ) -> Result<(), Error>

fill in a field (see the head of edit/form.rs); when it fails, the update is as it was

Source

pub fn flatten(&mut self, names: Option<&[&str]>) -> Result<(), Error>

draw the fields (all, or those named and their kids) into their pages and take them out of the form; when it fails, the update is as it was

Source§

impl Update<'_>

Source

pub fn save_full(&self, opts: &Full<'_>) -> Result<Vec<u8>, Error>

the document written again in full, with the update’s changes (see edit::full)

Source§

impl<'a> Update<'a>

Source

pub fn new(doc: &'a Document) -> Update<'a>

no changes yet

Source

pub fn document(&self) -> &'a Document

the document the update changes

Source

pub fn get(&self, r: Ref) -> Object

an object as the update will have it: changed, added, or as in the file (Null when deleted or missing; a stream added here gives its dictionary)

Source

pub fn resolve(&self, o: &Object) -> Object

follow references until an object that is none (Null after too many)

Source

pub fn add(&mut self, o: Object) -> Result<Ref, Error>

a new object (not a stream: add_stream), and its reference

Source

pub fn add_stream(&mut self, dict: Dict, data: &[u8]) -> Result<Ref, Error>

a new stream of data, compressed with FlateDecode (dict: its other keys)

Source

pub fn add_stream_raw( &mut self, dict: Dict, encoded: Vec<u8>, ) -> Result<Ref, Error>

a new stream whose data is encoded already as the filters of dict say

Source

pub fn set(&mut self, r: Ref, o: Object) -> Result<(), Error>

object r becomes o. A stream from the document keeps its data (decrypted first when it was another object’s)

Source

pub fn set_stream( &mut self, r: Ref, dict: Dict, data: &[u8], ) -> Result<(), Error>

stream r becomes data, compressed with FlateDecode (dict: its other keys)

Source

pub fn delete(&mut self, r: Ref)

object r is gone (a free entry with the next generation)

Source

pub fn is_empty(&self) -> bool

nothing changed

Source

pub fn save(&self) -> Result<Vec<u8>, Error>

the file with the update after it (the file as it was when nothing changed)

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Update<'a>

§

impl<'a> !Send for Update<'a>

§

impl<'a> !Sync for Update<'a>

§

impl<'a> !UnwindSafe for Update<'a>

§

impl<'a> Forget for Update<'a>

§

impl<'a> Freeze for Update<'a>
where &'a Document: Freeze, *const LeafNode<u32, (u16, Item)> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(u32, (u16, Item))>>: Freeze, *const RcInner<dyn FontSource> is !null: Freeze, PhantomData<RcInner<dyn FontSource>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<FontData>: Freeze, PhantomData<(String, [Ref; 5])>: Freeze, PhantomData<Journal>: Freeze,

§

impl<'a> Move for Update<'a>

§

impl<'a> Unpin for Update<'a>
where &'a Document: Unpin, *const LeafNode<u32, (u16, Item)> is !null: Unpin, Box<(u32, (u16, Item))>: Unpin, Rc<dyn FontSource>: Unpin, *const u8 is !null: Unpin, Arc<SharedFontRepr>: Unpin, Arc<VariedInstance>: Unpin, *const LeafNode<u16, Option<String>> is !null: Unpin, Box<(u16, Option<String>)>: Unpin, *const LeafNode<u32, Option<(u16, Item)>> is !null: Unpin, Box<(u32, Option<(u16, Item)>)>: Unpin,

§

impl<'a> UnsafeUnpin for Update<'a>
where &'a Document: UnsafeUnpin, *const LeafNode<u32, (u16, Item)> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(u32, (u16, Item))>>: UnsafeUnpin, *const RcInner<dyn FontSource> is !null: UnsafeUnpin, PhantomData<RcInner<dyn FontSource>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<FontData>: UnsafeUnpin, PhantomData<(String, [Ref; 5])>: UnsafeUnpin, PhantomData<Journal>: UnsafeUnpin,

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> ErasedDestructor for T
where T: 'static,

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