pub struct ElementAttributes(/* 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 ElementAttributes
impl ElementAttributes
Sourcepub fn iter(&self) -> impl Iterator<Item = (&AttributeName, &AttributeValue)>
pub fn iter(&self) -> impl Iterator<Item = (&AttributeName, &AttributeValue)>
Iterate over all attributes.
Sourcepub fn insert(&mut self, name: AttributeName, value: AttributeValue)
pub fn insert(&mut self, name: AttributeName, value: AttributeValue)
Insert a new attribute.
NOTE: This will NOT overwrite an existing attribute with the same name.
Sourcepub fn set(&mut self, name: AttributeName, value: AttributeValue)
pub fn set(&mut self, name: AttributeName, value: AttributeValue)
Set an attribute, overwriting any existing value.
Sourcepub fn get(&self, name: &str) -> Option<&AttributeValue>
pub fn get(&self, name: &str) -> Option<&AttributeValue>
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>
pub fn remove(&mut self, name: &str) -> Option<AttributeValue>
Remove an attribute by name.
Sourcepub fn get_string(&self, name: &str) -> Option<String>
pub fn get_string(&self, name: &str) -> Option<String>
Helper to get a string value.
Strips surrounding quotes from the value if present (parser quirk workaround).
Trait Implementations§
Source§impl Clone for ElementAttributes
impl Clone for ElementAttributes
Source§fn clone(&self) -> ElementAttributes
fn clone(&self) -> ElementAttributes
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 Debug for ElementAttributes
impl Debug for ElementAttributes
Source§impl Default for ElementAttributes
impl Default for ElementAttributes
Source§impl<'de> Deserialize<'de> for ElementAttributes
impl<'de> Deserialize<'de> for ElementAttributes
Source§fn deserialize<D>(deserializer: D) -> Result<ElementAttributes, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<ElementAttributes, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ElementAttributes
impl PartialEq for ElementAttributes
Source§impl Serialize for ElementAttributes
impl Serialize for ElementAttributes
impl StructuralPartialEq for ElementAttributes
Auto Trait Implementations§
impl Freeze for ElementAttributes
impl RefUnwindSafe for ElementAttributes
impl Send for ElementAttributes
impl Sync for ElementAttributes
impl Unpin for ElementAttributes
impl UnwindSafe for ElementAttributes
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