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
impl PreparedDocument
Sourcepub fn open(docx: &[u8], options: &Options) -> Result<Self, Error>
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.
Sourcepub fn open_source(
source: Arc<dyn RandomAccessRead>,
options: &Options,
) -> Result<Self, Error>
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.
Sourcepub fn font_needs(&self) -> Vec<(Option<String>, Vec<String>)>
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.
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Number of top-level blocks in the document body.
Trait Implementations§
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 PreparedDocumentwhere
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 PreparedDocumentwhere
*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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.