ics/
lib.rs

1//! A library for creating ICalendar files.
2//!
3//! The library supports the ICalendar specification [RFC5545](https://tools.ietf.org/html/rfc5545) version 2.0 and also [RFC7986](https://tools.ietf.org/html/rfc7986).
4//!
5//! # Installation
6//! To use this library add the library as a dependency in your `Cargo.toml`:
7//! ```toml
8//! [dependencies]
9//! ics = "0.5"
10//! ```
11//!
12//! By default some features are enabled. If you wish to disable them, specify
13//! in your `Cargo.toml`:
14//! ```toml
15//! [dependencies.ics]
16//! version = "0.5"
17//! default-features = false
18//! ```
19//!
20//! # Features
21//! - `rfc7986` (enabled by default): adds properties from the newer
22//!   specification [RFC7986](https://tools.ietf.org/html/rfc7986)
23//!
24//! # Example
25//! ```
26//! use ics::properties::{Comment, Status, Summary};
27//! use ics::{ICalendar, ToDo};
28//!
29//! fn main() -> std::io::Result<()> {
30//!     // Anything that can be converted to a Cow<str> is accepted as value which means
31//!     // &str and String can be used freely. For the sake of demonstrating the UID was
32//!     // taken from somewhere. Out of security reasons the UID should always be
33//!     // randomly generated.
34//!     let mut todo = ToDo::new("d4092ed9-1667-4518-a7c0-bcfaac4f1fc6", "20181021T190000");
35//!     todo.push(Summary::new("Katarina's Birthday Present"));
36//!     todo.push(Comment::new("Buy her Imagine Dragons tickets!"));
37//!     todo.push(Status::needs_action());
38//!
39//!     // The ICalendar object is what is later written to the file.
40//!     let mut calendar = ICalendar::new("2.0", "ics-rs");
41//!     calendar.add_todo(todo);
42//!
43//!     // Write `calendar` to a file.
44//!     calendar.save_file("birthday.ics")?;
45//!     Ok(())
46//! }
47//! ```
48
49#![forbid(unsafe_code, missing_docs)]
50
51#[macro_use]
52mod macros;
53pub mod components;
54mod contentline;
55mod ical;
56pub mod parameters;
57pub mod properties;
58mod util;
59
60pub use ical::Alarm;
61pub use ical::Daylight;
62pub use ical::Event;
63pub use ical::FreeBusy;
64pub use ical::ICalendar;
65pub use ical::Journal;
66pub use ical::Standard;
67pub use ical::TimeZone;
68pub use ical::ToDo;
69
70pub use util::escape_text;