pub struct MetadataRefinement {
pub refines: String,
pub property: String,
pub value: String,
pub lang: Option<String>,
pub scheme: Option<String>,
}Expand description
Represents a refinement of a metadata item in an EPUB 3.0 publication
The MetadataRefinement structure provides additional details about a parent metadata item.
Refinements are used in EPUB 3.0 to add granular metadata information that would be difficult
to express with the basic metadata structure alone.
For example, a creator metadata item might have refinements specifying the creator’s role or the scheme used for an identifier.
§Builder Methods
When the builder feature is enabled, this struct provides convenient builder methods:
use lib_epub::types::MetadataRefinement;
let refinement = MetadataRefinement::new("creator-1", "role", "author")
.with_lang("en")
.with_scheme("marc:relators")
.build();Fields§
§refines: String§property: StringThe refinement property name
Specifies what aspect of the parent metadata item this refinement describes. Common refinement properties include “role”, “file-as”, “alternate-script”, etc.
value: StringThe refinement value
lang: Option<String>Optional language code for this refinement
scheme: Option<String>Optional scheme identifier for this refinement
Specifies the vocabulary or scheme used for the refinement value. For example, “marc:relators” for MARC relator codes, or “onix:codelist5” for ONIX roles.
Implementations§
Source§impl MetadataRefinement
impl MetadataRefinement
Sourcepub fn new(refines: &str, property: &str, value: &str) -> Self
pub fn new(refines: &str, property: &str, value: &str) -> Self
Creates a new metadata refinement
Requires the builder feature.
§Parameters
refines- The ID of the metadata item being refinedproperty- The refinement property namevalue- The refinement value
Sourcepub fn with_lang(&mut self, lang: &str) -> &mut Self
pub fn with_lang(&mut self, lang: &str) -> &mut Self
Sets the language of the refinement
Requires the builder feature.
§Parameters
lang- The language code
Sourcepub fn with_scheme(&mut self, scheme: &str) -> &mut Self
pub fn with_scheme(&mut self, scheme: &str) -> &mut Self
Sets the scheme of the refinement
Requires the builder feature.
§Parameters
scheme- The scheme identifier
Trait Implementations§
Source§impl Clone for MetadataRefinement
impl Clone for MetadataRefinement
Source§fn clone(&self) -> MetadataRefinement
fn clone(&self) -> MetadataRefinement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more