#ical #parser #rfc5545 #rfc7986

icalendar

Strongly typed iCalendar builder and parser

42 releases

0.16.9 Oct 6, 2024
0.16.5 Aug 26, 2024
0.16.2 Jul 7, 2024
0.16.0 Nov 22, 2023
0.1.0 Nov 20, 2016

#24 in Date and time

Download history 1080/week @ 2024-07-29 507/week @ 2024-08-05 829/week @ 2024-08-12 653/week @ 2024-08-19 1097/week @ 2024-08-26 825/week @ 2024-09-02 1356/week @ 2024-09-09 821/week @ 2024-09-16 1020/week @ 2024-09-23 853/week @ 2024-09-30 599/week @ 2024-10-07 1090/week @ 2024-10-14 1369/week @ 2024-10-21 1554/week @ 2024-10-28 1726/week @ 2024-11-04 1536/week @ 2024-11-11

6,330 downloads per month
Used in 17 crates (16 directly)

MIT/Apache

165KB
3.5K SLoC

iCalendar in Rust

build Crates.io contributors maintenance

version documentation license

A builder [and parser] for rfc5545 iCalendar.

You want to help make this more mature? Please talk to me, Pull Requests and suggestions are very welcome.

Example

Use the builder-pattern to assemble the full calender or event by event. Display printing produces the rfc5545 format.

// lets create a calendar
let my_calendar = Calendar::new()
    .name("example calendar")
    .push(
        // add an event
        Event::new()
            .summary("test event")
            .description("here I have something really important to do")
            .starts(Utc::now())
            .class(Class::Confidential)
            .ends(Utc::now() + Duration::days(1))
            .append_property(
                Property::new("TEST", "FOOBAR")
                    .add_parameter("IMPORTANCE", "very")
                    .add_parameter("DUE", "tomorrow")
                    .done(),
            )
            .done(),
    )
    .push(
        // add a todo
        Todo::new()
            .summary("groceries")
            .description("Buy some milk")
            .done(),
    )
    .push(
        // add an all-day event
        Event::new()
            .all_day(NaiveDate::from_ymd_opt(2016, 3, 15).unwrap())
            .summary("My Birthday")
            .description("Hey, I'm gonna have a party\nBYOB: Bring your own beer.\nHendrik")
            .done(),
    )
    .push(
        // local event with timezone
        Event::new()
            .starts(CalendarDateTime::from_ymd_hm_tzid(2023, 3, 15, 18, 45, Berlin).unwrap())
            .summary("Birthday Party")
            .description("I'm gonna have a party\nBYOB: Bring your own beer.\nHendrik")
            .done(),
    )
    .done();

println!("{}", my_calendar);

Parsing

There is a feature called "parser" which allows you to read calendars again like this:

//... continue from previous example

let parsed_calendar = my_calendar.parse::<Calendar>()?;

License

icalendar-rs is licensed under either of

at your option.

Contribution

Any help in form of descriptive and friendly issues or comprehensive pull requests are welcome!

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in icalendar-rs by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~2–9MB
~54K SLoC