iCalendar in Rust
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.
Usage & Documentation
Please see the documentation for current examples.
Below are a few examples of how to use this library. See the examples directory as well as the documentation for many more.
Building a new Calendar
Use the builder-pattern to assemble the full calendar or event by event. Display printing produces the rfc5545 format.
use ;
use ;
// let's create a calendar
let my_calendar = new
.name
.push
.push
.push
.push
.done;
println!;
Removing Properties from Components
You can remove properties from components when you need to update their state:
use ;
use Utc;
// Create a completed todo
let mut todo = new;
todo
.summary
.completed
.percent_complete
.status;
// Later, mark it as uncompleted by removing completion properties
todo.mark_uncompleted;
// This removes COMPLETED, PERCENT-COMPLETE, and STATUS properties
// For events, you can remove specific properties
let mut event = new;
event
.summary
.status;
// Remove the cancelled status
event.remove_status;
// You can also remove any property directly
event.remove_property;
Parsing a Calendar
There is a feature called "parser" which allows you to read calendars again like this:
use read_to_string;
use ;
let contents = read_to_string.unwrap;
let parsed_calendar: Calendar = contents.parse.unwrap;
for event in parsed_calendar.events
Structure
A [Calendar] represents a full calendar, which contains multiple [Component]s. These may be either [Event]s, [Todo]s, or [Venue]s. Components in turn have [Property]s, which may have [Parameter]s.
RRule Support
Thanks to the rrule crate and friendly community contribution, you can also add recurrence rules to your events and todos. See the documentation for Event::recurrence and Todo::recurrence for details.
We currently reexport a select subset of rrule types. Should you experience compatibility issues because the maintainer (me) has not yet updated icalendar to reexport the latest rrule version, please feel free to open a PR.
Contributing
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 by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Conventions
The Changelog of this library is generated from its commit log, there any commit message must conform with https://www.conventionalcommits.org/en/v1.0.0/. For simplicity you could make your commits with convco.
Recognition
Thanks goes to these wonderful people: