pub struct ElementAttributes<'a>(/* private fields */);Expand description
Element-level attributes (for blocks, sections, etc.).
These attributes are specific to individual elements and start empty.
Use ElementAttributes::default() to get an empty attribute map.
Implementations§
Source§impl<'a> ElementAttributes<'a>
impl<'a> ElementAttributes<'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 into_static(self) -> ElementAttributes<'static>
pub fn into_static(self) -> ElementAttributes<'static>
Convert all borrowed content to owned, producing 'static lifetime attributes.
Trait Implementations§
Source§impl<'a> Clone for ElementAttributes<'a>
impl<'a> Clone for ElementAttributes<'a>
Source§fn clone(&self) -> ElementAttributes<'a>
fn clone(&self) -> ElementAttributes<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for ElementAttributes<'a>
impl<'a> Debug for ElementAttributes<'a>
Source§impl Default for ElementAttributes<'_>
impl Default for ElementAttributes<'_>
Source§impl<'a> PartialEq for ElementAttributes<'a>
impl<'a> PartialEq for ElementAttributes<'a>
Source§impl Serialize for ElementAttributes<'_>
impl Serialize for ElementAttributes<'_>
impl<'a> StructuralPartialEq for ElementAttributes<'a>
Auto Trait Implementations§
impl<'a> Freeze for ElementAttributes<'a>
impl<'a> RefUnwindSafe for ElementAttributes<'a>
impl<'a> Send for ElementAttributes<'a>
impl<'a> Sync for ElementAttributes<'a>
impl<'a> Unpin for ElementAttributes<'a>
impl<'a> UnsafeUnpin for ElementAttributes<'a>
impl<'a> UnwindSafe for ElementAttributes<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more