pub struct DocumentAttributes<'a>(/* private fields */);Expand description
Document-level attributes with universal defaults.
These attributes apply to the entire document and include defaults for admonition captions, TOC settings, structural settings, etc.
Use DocumentAttributes::default() to get a map with universal defaults applied.
Implementations§
Source§impl<'a> DocumentAttributes<'a>
impl<'a> DocumentAttributes<'a>
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&AttributeName<'a>, &AttributeValue<'a>)>
pub fn iter( &self, ) -> impl Iterator<Item = (&AttributeName<'a>, &AttributeValue<'a>)>
Iterate over all attributes.
Sourcepub fn insert(&mut self, name: AttributeName<'a>, value: AttributeValue<'a>)
pub fn insert(&mut self, name: AttributeName<'a>, value: AttributeValue<'a>)
Insert a new attribute.
NOTE: This will NOT overwrite an existing attribute with the same name.
Sourcepub fn set(&mut self, name: AttributeName<'a>, value: AttributeValue<'a>)
pub fn set(&mut self, name: AttributeName<'a>, value: AttributeValue<'a>)
Set an attribute, overwriting any existing value.
Sourcepub fn get(&self, name: &str) -> Option<&AttributeValue<'a>>
pub fn get(&self, name: &str) -> Option<&AttributeValue<'a>>
Get an attribute value by name.
Sourcepub fn contains_key(&self, name: &str) -> bool
pub fn contains_key(&self, name: &str) -> bool
Check if an attribute exists.
Sourcepub fn remove(&mut self, name: &str) -> Option<AttributeValue<'a>>
pub fn remove(&mut self, name: &str) -> Option<AttributeValue<'a>>
Remove an attribute by name.
Sourcepub fn get_string(&self, name: &str) -> Option<Cow<'a, str>>
pub fn get_string(&self, name: &str) -> Option<Cow<'a, str>>
Helper to get a string value.
Strips surrounding quotes from the value if present (parser quirk workaround).
Sourcepub fn to_static(&self) -> DocumentAttributes<'static>
pub fn to_static(&self) -> DocumentAttributes<'static>
Clone the attributes into an independent 'static copy. Used by
converters that cache document attributes on a processor whose
lifetime is independent of the document being rendered.
Sourcepub fn into_static(self) -> DocumentAttributes<'static>
pub fn into_static(self) -> DocumentAttributes<'static>
Consume the attributes, producing an independent 'static copy.
Trait Implementations§
Source§impl<'a> Clone for DocumentAttributes<'a>
impl<'a> Clone for DocumentAttributes<'a>
Source§fn clone(&self) -> DocumentAttributes<'a>
fn clone(&self) -> DocumentAttributes<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more