Struct svgdom::Attributes
[−]
[src]
pub struct Attributes(_);
Wrapper around attributes list.
More low level API than in Node
, but it supports getting a reference to the attribute,
and not only copy like Node
's API.
Use with care, since it didn't perform many check from Node
's API.
Methods
impl Attributes
[src]
fn new() -> Attributes
Constructs a new attribute.
Warning: newer construct it manually. All nodes has Attributes
by default.
fn get(&self, id: AttributeId) -> Option<&Attribute>
Returns a optional reference to Attribute
.
fn get_mut(&mut self, id: AttributeId) -> Option<&mut Attribute>
Returns a optional mutable reference to Attribute
.
fn get_value(&self, id: AttributeId) -> Option<&AttributeValue>
Returns optional reference to AttributeValue
.
fn insert(&mut self, attr: Attribute)
Inserts new attribute. Previous will be overwritten.
Warning: this method did not perform any checks for linked attributes.
If you want to insert an linked attribute - use Node::set_link_attribute()
.
fn remove(&mut self, id: AttributeId)
Removes an existing attribute.
Warning: this method did not perform any checks for linked attributes.
If you want to remove an linked attribute - use Node::remove_attribute()
.
fn contains(&self, id: AttributeId) -> bool
Returns true
if container contains an attribute such id
.
fn len(&self) -> usize
Returns count of the attributes.
fn is_empty(&self) -> bool
Returns true
if attributes list is empty.
fn iter(&self) -> Iter<Attribute>
Returns an iterator.
fn iter_mut(&mut self) -> IterMut<Attribute>
Returns a mutable iterator.
fn retain<F>(&mut self, f: F) where F: FnMut(&Attribute) -> bool
Retains only the elements specified by the predicate.
fn get_or<'a>(&'a self, id: AttributeId, def_value: &'a AttributeValue) -> &AttributeValue
Returns an existing attribute or def_value
.