pub struct Extension {
pub name: String,
pub value: Option<String>,
pub attrs: BTreeMap<String, String>,
pub children: BTreeMap<String, Vec<Extension>>,
}
Expand description
A namespaced extension.
Fields§
§name: String
The qualified name of the extension element.
value: Option<String>
The content of the extension element.
attrs: BTreeMap<String, String>
The attributes for the extension element.
children: BTreeMap<String, Vec<Extension>>
The children of the extension element. A map of local names to child elements.
Implementations§
Source§impl Extension
impl Extension
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Return the qualified name of this extension.
§Examples
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_name("ext:name");
assert_eq!(extension.name(), "ext:name");
Sourcepub fn set_name<V>(&mut self, name: V)
pub fn set_name<V>(&mut self, name: V)
Set the qualified name of this extension.
§Examples
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_name("ext:name");
Sourcepub fn value(&self) -> Option<&str>
pub fn value(&self) -> Option<&str>
Return the text content of this extension.
§Examples
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_value("John Doe".to_string());
assert_eq!(extension.value(), Some("John Doe"));
Sourcepub fn set_value<V>(&mut self, value: V)
pub fn set_value<V>(&mut self, value: V)
Set the text content of this extension.
§Examples
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_value("John Doe".to_string());
Sourcepub fn attrs(&self) -> &BTreeMap<String, String>
pub fn attrs(&self) -> &BTreeMap<String, String>
Return the attributes for the extension element.
§Examples
use std::collections::BTreeMap;
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
let mut attrs = BTreeMap::<String, String>::new();
attrs.insert("email".to_string(), "johndoe@example.com".to_string());
extension.set_attrs(attrs.clone());
assert_eq!(*extension.attrs(), attrs);
Sourcepub fn set_attrs<V>(&mut self, attrs: V)
pub fn set_attrs<V>(&mut self, attrs: V)
Set the attributes for the extension element.
§Examples
use std::collections::BTreeMap;
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_attrs(BTreeMap::new());
Sourcepub fn children(&self) -> &BTreeMap<String, Vec<Extension>>
pub fn children(&self) -> &BTreeMap<String, Vec<Extension>>
Return the children of the extension element.
A map of local names to child elements.
§Examples
use std::collections::BTreeMap;
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
let mut children = BTreeMap::<String, Vec<Extension>>::new();
children.insert("ext:child".to_string(), Vec::new());
extension.set_children(children);
assert!(extension.children().contains_key("ext:child"));
Sourcepub fn set_children<V>(&mut self, children: V)
pub fn set_children<V>(&mut self, children: V)
Set the children of the extension element.
A map of local names to child elements.
§Examples
use std::collections::BTreeMap;
use atom_syndication::extension::Extension;
let mut extension = Extension::default();
extension.set_children(BTreeMap::new());
Trait Implementations§
impl StructuralPartialEq for Extension
Auto Trait Implementations§
impl Freeze for Extension
impl RefUnwindSafe for Extension
impl Send for Extension
impl Sync for Extension
impl Unpin for Extension
impl UnwindSafe for Extension
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