Skip to main content

DocumentBuilder

Struct DocumentBuilder 

Source
pub struct DocumentBuilder { /* private fields */ }

Implementations§

Source§

impl DocumentBuilder

Source

pub fn add( &mut self, target: impl AsRef<str>, content: ContentBuilder, ) -> &mut Self

Add a content document

Appends a new content document to be processed during EPUB building.

§Parameters
  • target: The target path within the EPUB container where the content will be placed
  • content: The content builder containing the document content
§Return
  • &mut Self: Returns a mutable reference to itself for method chaining
Source

pub fn clear(&mut self) -> &mut Self

Clear all documents

Removes all content documents from the builder.

Source

pub fn make( &mut self, temp_dir: PathBuf, rootfile: impl AsRef<str>, ) -> Result<Vec<ManifestItem>, EpubError>

Generate manifest items from content documents

Processes all content documents and generates the corresponding manifest items. Each content document may generate multiple manifest entries - one for the main document and additional entries for any resources (images, fonts, etc.) it contains.

§Parameters
  • temp_dir: The temporary directory path used during the EPUB build process
  • rootfile: The path to the OPF file (package document)
§Return
  • Ok(Vec<ManifestItem>): List of manifest items generated from the content documents
  • Err(EpubError): Error if document generation or file processing fails

Trait Implementations§

Source§

impl Debug for DocumentBuilder

Source§

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

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.