1
use crate::convert::ToModel;
2

            
3
impl ToModel for crate::parser::types::ICalendar<'_> {
4
    type Model = crate::model::object::ICalObject;
5

            
6
222
    fn to_model(&self) -> anyhow::Result<Self::Model> {
7
222
        let mut calendar = crate::model::object::ICalObject::new();
8
222

            
9
222
        calendar.properties.reserve(self.properties.len());
10
688
        for property in &self.properties {
11
466
            calendar.properties.push(property.to_model()?);
12
        }
13

            
14
222
        calendar.components.reserve(self.components.len());
15
506
        for component in &self.components {
16
284
            calendar.components.push(component.to_model()?);
17
        }
18

            
19
222
        Ok(calendar)
20
222
    }
21
}