pub struct Component {
pub name: String,
pub props: BTreeMap<String, Vec<Property>>,
pub subcomponents: Vec<Component>,
}
Fields§
§name: String
The name of the component, such as VCARD
or VEVENT
.
props: BTreeMap<String, Vec<Property>>
The component’s properties.
subcomponents: Vec<Component>
The component’s child- or sub-components.
Implementations§
source§impl Component
impl Component
pub fn new<N: Into<String>>(name: N) -> Component
sourcepub fn push(&mut self, prop: Property)
pub fn push(&mut self, prop: Property)
Append the given property, preserve other same-named properties.
sourcepub fn set(&mut self, prop: Property)
pub fn set(&mut self, prop: Property)
Set the given property, remove other same-named properties.
sourcepub fn get_only<P: AsRef<str>>(&self, name: P) -> Option<&Property>
pub fn get_only<P: AsRef<str>>(&self, name: P) -> Option<&Property>
Retrieve one property by key. Returns None
if not exactly one property was found.