Skip to main content

MetadataSheet

Struct MetadataSheet 

Source
pub struct MetadataSheet {
Show 15 fields pub contributor: Vec<String>, pub creator: Vec<String>, pub date: HashMap<String, String>, pub identifier: HashMap<String, String>, pub language: Vec<String>, pub relation: Vec<String>, pub subject: Vec<String>, pub title: Vec<String>, pub coverage: String, pub description: String, pub format: String, pub publisher: String, pub rights: String, pub source: String, pub epub_type: String,
}
Expand description

A unified metadata sheet for EPUB publications

This struct provides a simplified, high-level interface for accessing EPUB metadata. It consolidates metadata from both EPUB 2 and EPUB 3 specifications into a single convenient structure, with separate storage for multi-value fields and single-value fields.

Fields§

§contributor: Vec<String>

Contributors to the publication (e.g., editors, translators)

§creator: Vec<String>

Primary creators/authors of the publication

§date: HashMap<String, String>

Date information with optional event types (e.g., publication, creation)

§identifier: HashMap<String, String>

Unique identifiers with their assigned IDs as keys

§language: Vec<String>

Language codes for the publication content

§relation: Vec<String>

References to related resources

§subject: Vec<String>

Subject keywords or topics

§title: Vec<String>

Title(s) of the publication

§coverage: String

Spatial or temporal coverage of the publication

§description: String

Description or abstract of the publication

§format: String

Physical or digital format of the publication

§publisher: String

Publisher information

§rights: String

Copyright and licensing rights

§source: String

Reference to the source publication

§epub_type: String

EPUB-specific type identifier

Implementations§

Source§

impl MetadataSheet

Source

pub fn new() -> Self

Creates a new MetadataSheet instance

Source§

impl MetadataSheet

Source

pub fn append_contributor( &mut self, contributor: impl Into<String>, ) -> &mut Self

Appends a contributor to the metadata

Source

pub fn append_creator(&mut self, creator: impl Into<String>) -> &mut Self

Appends a creator to the metadata

Source

pub fn append_language(&mut self, language: impl Into<String>) -> &mut Self

Appends a language to the metadata

Source

pub fn append_relation(&mut self, relation: impl Into<String>) -> &mut Self

Appends a relation to the metadata

Source

pub fn append_subject(&mut self, subject: impl Into<String>) -> &mut Self

Appends a subject to the metadata

Source

pub fn append_title(&mut self, title: impl Into<String>) -> &mut Self

Appends a title to the metadata

Source

pub fn append_date( &mut self, date: impl Into<String>, event: impl Into<String>, ) -> &mut Self

Sets a date value with optional event type

Parameters:

  • date: The date value (used as key to allow multiple dates)
  • event: Optional event type (e.g., “publication”, “creation”, “modification”)

Note: Multiple dates can be stored. The date string is used as the key, and the event type (if any) is stored as the value.

Source

pub fn append_identifier( &mut self, id: impl Into<String>, value: impl Into<String>, ) -> &mut Self

Sets an identifier with id (e.g., “book-id”, “isbn-id”)

Source

pub fn with_coverage(&mut self, coverage: impl Into<String>) -> &mut Self

Sets coverage

Source

pub fn with_description(&mut self, description: impl Into<String>) -> &mut Self

Sets description

Source

pub fn with_format(&mut self, format: impl Into<String>) -> &mut Self

Sets format

Source

pub fn with_publisher(&mut self, publisher: impl Into<String>) -> &mut Self

Sets publisher

Source

pub fn with_rights(&mut self, rights: impl Into<String>) -> &mut Self

Sets rights

Source

pub fn with_source(&mut self, source: impl Into<String>) -> &mut Self

Sets source

Source

pub fn with_epub_type(&mut self, epub_type: impl Into<String>) -> &mut Self

Sets epub type

Source

pub fn build(&self) -> MetadataSheet

Builds the Metadata instance (returns a clone)

Trait Implementations§

Source§

impl Debug for MetadataSheet

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for MetadataSheet

Source§

fn default() -> MetadataSheet

Returns the “default value” for a type. Read more
Source§

impl From<MetadataSheet> for Vec<MetadataItem>

Available on crate feature builder only.
Source§

fn from(sheet: MetadataSheet) -> Vec<MetadataItem>

Converts a MetadataSheet into a Vec<MetadataItem> for EPUB use

This conversion maps Dublin Core metadata fields from MetadataSheet to the EPUB-compliant MetadataItem format. Each field in MetadataSheet is converted to a corresponding MetadataItem.

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.