1
use aetolia::prelude::*;
2

            
3
3
fn main() {
4
3
    let input = std::fs::File::open("sample.ics").unwrap();
5
3
    let ical = load_ical(input).unwrap();
6
3
    println!("Loaded iCal document with {} object", ical.len());
7

            
8
6
    for component in &ical[0].components {
9
6
        match component {
10
3
            CalendarComponent::TimeZone(tz) => {
11
3
                println!(
12
3
                    "Found timezone with name: {}",
13
3
                    tz.get_property::<TimeZoneIdProperty>().unwrap().value().id
14
3
                );
15
3
            }
16
3
            CalendarComponent::Event(e) => {
17
3
                println!(
18
3
                    "Found event with description: {}",
19
3
                    e.get_property::<DescriptionProperty>().unwrap().value()
20
3
                );
21
3

            
22
3
                let attendees = e.get_properties::<AttendeeProperty>();
23
3
                let role_param = attendees[0].get_param::<RoleParam>().unwrap();
24
3
                println!(
25
3
                    "Found attendee {} with role: {:?}",
26
3
                    attendees[0].value(),
27
3
                    role_param.role
28
3
                );
29
3
            }
30
            _ => {}
31
        }
32
    }
33

            
34
3
    let validation_errors = validate_model(&ical[0]).unwrap();
35
3
    assert!(
36
3
        validation_errors.is_empty(),
37
        "Didn't expect any validation errors"
38
    );
39
3
}