#ical #calendar #parser #ics

icalendar

Strongly typed iCalendar builder and parser

34 releases

0.16.1 Apr 7, 2024
0.16.0 Nov 22, 2023
0.15.9 Nov 22, 2023
0.15.6 Jul 22, 2023
0.1.0 Nov 20, 2016

#14 in Date and time

Download history 1532/week @ 2024-01-01 1116/week @ 2024-01-08 1405/week @ 2024-01-15 1339/week @ 2024-01-22 1752/week @ 2024-01-29 1184/week @ 2024-02-05 1214/week @ 2024-02-12 1559/week @ 2024-02-19 1085/week @ 2024-02-26 1148/week @ 2024-03-04 852/week @ 2024-03-11 1132/week @ 2024-03-18 1174/week @ 2024-03-25 9764/week @ 2024-04-01 795/week @ 2024-04-08 1436/week @ 2024-04-15

13,242 downloads per month
Used in 16 crates (15 directly)

MIT/Apache

155KB
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

~1.8–3MB
~49K SLoC