Skip to main content

PreparedDocument

Struct PreparedDocument 

Source
pub struct PreparedDocument { /* private fields */ }
Expand description

A DOCX file opened and parsed once, ready for fast font discovery and incremental layout.

Implementations§

Source§

impl PreparedDocument

Source

pub fn open(docx: &[u8], options: &Options) -> Result<Self, Error>

Opens and parses docx once for options.

§Errors

Returns an error when the package, XML, or configuration cannot be read.

Source

pub fn open_source( source: Arc<dyn RandomAccessRead>, options: &Options, ) -> Result<Self, Error>

Opens and parses a random-access DOCX source once for options.

§Errors

Returns an error when the package, XML, or configuration cannot be read.

Source

pub fn font_needs(&self) -> Vec<(Option<String>, Vec<String>)>

Quickly scans the parsed document for (asked, tried) font needs without running a dummy full-document layout pass.

Source

pub fn block_count(&self) -> usize

Number of top-level blocks in the document body.

Trait Implementations§

Source§

impl Debug for PreparedDocument

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for PreparedDocument

§

impl !RefUnwindSafe for PreparedDocument

§

impl !Send for PreparedDocument

§

impl !Sync for PreparedDocument

§

impl !UnwindSafe for PreparedDocument

§

impl Forget for PreparedDocument

§

impl Move for PreparedDocument

§

impl Unpin for PreparedDocument
where Arc<Mutex<Option<ZipArchive<BackingReader>>>>: Unpin, *const LeafNode<String, Part> is !null: Unpin, Box<(String, Part)>: Unpin, *const LeafNode<String, OnceLock<Result<RelationshipsPart, Error>>> is !null: Unpin, Box<(String, OnceLock<Result<RelationshipsPart, Error>>)>: Unpin, *const u8 is !null: Unpin, Arc<Atomic<u64>>: Unpin, NonZero<u32>: Unpin, *const LeafNode<String, bool> is !null: Unpin, Box<(String, bool)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, Arc<[(Arc<str>, Layer)]>: Unpin, &'static PageSizes: Unpin, Arc<FontEnvironment>: Unpin, Arc<SymbolFonts>: Unpin, Arc<Merged>: Unpin, Align8<u64>: Unpin, Arc<HashMap<String, Property>>: Unpin, &'static [char; 10]: Unpin, &'static Counting: Unpin, &'static [&'static str]: Unpin, NonZero<usize>: Unpin, Rc<Name>: Unpin, Box<Borders>: Unpin, Box<NamedSides>: Unpin, Box<FramePr>: Unpin, Box<LinearGradient>: Unpin, Box<TextReflection>: Unpin, Box<FontRef>: Unpin, Box<str>: Unpin, Box<ParaProps>: Unpin, &'static str: Unpin, String: Unpin, Rc<Numbering>: Unpin, Rc<Notes>: Unpin, Rc<Comments>: Unpin, Box<DateField>: Unpin, Box<DocProperty>: Unpin, Box<FileNameField>: Unpin, Box<StyleRef>: Unpin, Box<PageRef>: Unpin, Box<NumberRef>: Unpin, Box<IfField>: Unpin, Box<Floating>: Unpin, Box<Picture>: Unpin, Rc<InlineDrawing>: Unpin, Box<CodeFormat>: Unpin, Box<Hyperlink>: Unpin, Rc<str>: Unpin, Rc<[Block]>: Unpin,

§

impl UnsafeUnpin for PreparedDocument
where *const ArcInner<Mutex<Option<ZipArchive<BackingReader>>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<Option<ZipArchive<BackingReader>>>>>: UnsafeUnpin, *const LeafNode<String, Part> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, Part)>>: UnsafeUnpin, *const LeafNode<String, OnceLock<Result<RelationshipsPart, Error>>> is !null: UnsafeUnpin, PhantomData<Box<(String, OnceLock<Result<RelationshipsPart, Error>>)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, *const ArcInner<Atomic<u64>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u64>>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const LeafNode<String, bool> is !null: UnsafeUnpin, PhantomData<Box<(String, bool)>>: UnsafeUnpin, *const LeafNode<String, String> is !null: UnsafeUnpin, PhantomData<Box<(String, String)>>: UnsafeUnpin, *const ArcInner<[(Arc<str>, Layer)]> is !null: UnsafeUnpin, PhantomData<ArcInner<[(Arc<str>, Layer)]>>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, &'static PageSizes: UnsafeUnpin, *const ArcInner<FontEnvironment> is !null: UnsafeUnpin, PhantomData<ArcInner<FontEnvironment>>: UnsafeUnpin, *const ArcInner<SymbolFonts> is !null: UnsafeUnpin, PhantomData<ArcInner<SymbolFonts>>: UnsafeUnpin, *const ArcInner<Merged> is !null: UnsafeUnpin, PhantomData<ArcInner<Merged>>: UnsafeUnpin, Align8<u64>: UnsafeUnpin, *const ArcInner<HashMap<String, Property>> is !null: UnsafeUnpin, PhantomData<ArcInner<HashMap<String, Property>>>: UnsafeUnpin, &'static [char; 10]: UnsafeUnpin, &'static Counting: UnsafeUnpin, &'static [&'static str]: UnsafeUnpin, NonZeroUsizeInner: UnsafeUnpin, *const RcInner<Name> is !null: UnsafeUnpin, PhantomData<RcInner<Name>>: UnsafeUnpin, PhantomData<TabMark>: UnsafeUnpin, *const Borders is !null: UnsafeUnpin, PhantomData<Borders>: UnsafeUnpin, *const NamedSides is !null: UnsafeUnpin, PhantomData<NamedSides>: UnsafeUnpin, *const FramePr is !null: UnsafeUnpin, PhantomData<FramePr>: UnsafeUnpin, PhantomData<Modifier>: UnsafeUnpin, *const LinearGradient is !null: UnsafeUnpin, PhantomData<LinearGradient>: UnsafeUnpin, *const TextReflection is !null: UnsafeUnpin, PhantomData<TextReflection>: UnsafeUnpin, *const FontRef is !null: UnsafeUnpin, PhantomData<FontRef>: UnsafeUnpin, *const str is !null: UnsafeUnpin, PhantomData<str>: UnsafeUnpin, PhantomData<(UnsupportedProperty, SetIn<bool>)>: UnsafeUnpin, *const ParaProps is !null: UnsafeUnpin, PhantomData<ParaProps>: UnsafeUnpin, PhantomData<(String, Style)>: UnsafeUnpin, PhantomData<(String, String)>: UnsafeUnpin, PhantomData<(i64, ThemeStopColor)>: UnsafeUnpin, PhantomData<[i64; 2]>: UnsafeUnpin, &'static str: UnsafeUnpin, PhantomData<(FamilyName, FamilyName)>: UnsafeUnpin, PhantomData<(FamilyName, EntryCharset)>: UnsafeUnpin, PhantomData<(FamilyName, Option<FontClass>)>: UnsafeUnpin, PhantomData<(FamilyName, EntryScript)>: UnsafeUnpin, *const RcInner<Numbering> is !null: UnsafeUnpin, PhantomData<RcInner<Numbering>>: UnsafeUnpin, *const RcInner<Notes> is !null: UnsafeUnpin, PhantomData<RcInner<Notes>>: UnsafeUnpin, *const RcInner<Comments> is !null: UnsafeUnpin, PhantomData<RcInner<Comments>>: UnsafeUnpin, PhantomData<Block>: UnsafeUnpin, PhantomData<SectionPart>: UnsafeUnpin, PhantomData<StoredEntry>: UnsafeUnpin, PhantomData<(String, u8)>: UnsafeUnpin, PhantomData<EntryField>: UnsafeUnpin, *const RcInner<str> is !null: UnsafeUnpin, PhantomData<RcInner<str>>: UnsafeUnpin, *const RcInner<[Block]> is !null: UnsafeUnpin, PhantomData<RcInner<[Block]>>: UnsafeUnpin, PhantomData<SectionLayout>: UnsafeUnpin, PhantomData<(Warning, u32)>: UnsafeUnpin, PhantomData<(Warning, usize)>: 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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.