pub struct ManifestBuilder { /* private fields */ }Expand description
Manifest builder for EPUB resources
The ManifestBuilder is responsible for managing manifest items in an EPUB publication.
The manifest declares all resources (HTML files, images, stylesheets, fonts, etc.)
that are part of the EPUB publication.
Each manifest item must have a unique identifier and a path to the resource file. The builder automatically determines the MIME type of each resource based on its content.
§Resource Fallbacks
The manifest supports fallback chains for resources that may not be supported by all reading systems. When adding a resource with a fallback, the builder validates that:
- The fallback chain does not contain circular references
- All referenced fallback resources exist in the manifest
§Navigation Document
The manifest must contain exactly one item with the nav property, which serves
as the navigation document (table of contents) of the publication.
Implementations§
Source§impl ManifestBuilder
impl ManifestBuilder
Sourcepub fn add(
&mut self,
manifest_source: impl Into<String>,
manifest_item: ManifestItem,
) -> Result<&mut Self, EpubError>
pub fn add( &mut self, manifest_source: impl Into<String>, manifest_item: ManifestItem, ) -> Result<&mut Self, EpubError>
Add a manifest item and copy the resource file
Adds a new resource to the manifest and copies the source file to the temporary directory. The builder automatically determines the MIME type based on the file content.
§Parameters
manifest_source: Path to the source file on the local filesystemmanifest_item: Manifest item with ID and target path
§Return
Ok(&mut Self): Successfully added the resourceErr(EpubError): Error if the source file doesn’t exist or has an unknown format