use crate::Attribute;
#[derive(Debug, Default, Clone)]
pub struct Attributes {
pub inner: Vec<Attribute>,
}
impl Attributes {
pub fn new() -> Attributes {
Attributes { inner: Vec::new() }
}
pub fn clear(&mut self) {
self.inner.clear();
}
pub fn push(&mut self, name: &str, value: &str) {
self.inner.push(Attribute::new(name, value));
}
pub fn get_by_key(&self, name: &str) -> Option<&Attribute> {
self.inner.iter().find(|&attribute| attribute.name == name)
}
pub fn extend(&mut self, attributes: Attributes) {
self.inner.extend(attributes.inner);
}
}