icalendar/components/
other.rsuse super::*;
#[derive(Debug, Default, PartialEq, Eq, Clone)]
pub struct Other {
name: String,
pub(super) inner: InnerComponent,
}
impl Component for Other {
fn component_kind(&self) -> String {
self.name.clone()
}
fn properties(&self) -> &BTreeMap<String, Property> {
&self.inner.properties
}
fn components(&self) -> &[Other] {
&self.inner.components
}
fn multi_properties(&self) -> &BTreeMap<String, Vec<Property>> {
&self.inner.multi_properties
}
fn append_property(&mut self, property: impl Into<Property>) -> &mut Self {
let property = property.into();
self.inner
.properties
.insert(property.key().to_owned(), property);
self
}
fn append_multi_property(&mut self, property: impl Into<Property>) -> &mut Self {
self.inner.insert_multi(property);
self
}
fn append_component(&mut self, child: impl Into<Other>) -> &mut Self {
self.inner.components.push(child.into());
self
}
}
impl From<(String, InnerComponent)> for Other {
fn from((name, inner): (String, InnerComponent)) -> Self {
Self { name, inner }
}
}