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.
Examples
Below are two 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 component in &parsed_calendar.components
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.
License
Icalendar (this crate) is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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 by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Thanks goes to these wonderful people: