1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
//! A library (far from anything) to generate icalendars
//! This implementation is still far from complete, I haven't even read the entire [spec](http://tools.ietf.org/html/rfc5545) yet.
//! Instead I implemented the parts I needed first.
//! More to come, contributions very welcome.
//!
//!
//! ## Structure
//! * `Calendar`s consist of `Components`
//! * `Component`s are e.g. `Event` or `Todo`
//! * `Component`s consist of `Property`s
//! * `Property`s may have `Parameter`s
//!
//! ```rust
//! # extern crate chrono;
//! # extern crate icalendar;
//! # use chrono::*;
//! # use icalendar::*;
//! # fn main() {
//! let 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();
//!
//! let bday = Event::new()
//! .all_day(Utc.ymd(2016, 3, 15))
//! .summary("My Birthday")
//! .description(
//! r#"Hey, I'm gonna have a party
//! BYOB: Bring your own beer.
//! Hendrik"#
//! )
//! .done();
//!
//! let todo = Todo::new().summary("Buy some milk").done();
//!
//!
//! let mut calendar = Calendar::new();
//! calendar.add(event);
//! calendar.add(todo);
//! calendar.add(bday);
//! # }
//! ```
//!
//! ## Breaking API Changes in version 0.7.0
//!
//! - [Todo::due] and [Todo::completed] now take their date-time argument by value rather than by
//! reference
//! - [Todo::completed] now requires its [chrono::DateTime] argument to have exactly [chrono::Utc]
//! specified as its time zone as mandated by the RFC.
//! - [Component::starts], [Component::ends] and [Todo::due] now take newly introduced
//! [CalendarDateTime] (through `Into<CalendarDateTime>` indirection). This allows callers to
//! define time zone handling. Conversions from [`chrono::NaiveDateTime`] and
//! [`chrono::DateTime<Utc>`](chrono::DateTime) are provided for ergonomics, the latter also restoring API
//! compatibility in case of UTC date-times.
#![warn(missing_docs,
missing_copy_implementations,
trivial_casts, trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces, unused_qualifications,
missing_debug_implementations
)]
macro_rules! print_crlf {
() => (print!("\r\n"));
($fmt:expr) => (print!(concat!($fmt, "\r\n")));
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\r\n"), $($arg)*));
}
macro_rules! write_crlf {
($dst:expr) => (
write!($dst, "\r\n")
);
($dst:expr, $fmt:expr) => (
write!($dst, concat!($fmt, "\r\n"))
);
($dst:expr, $fmt:expr, $($arg:tt)*) => (
write!($dst, concat!($fmt, "\r\n"), $($arg)*)
);
}
//pub mod period;
mod components;
mod properties;
mod calendar;
//pub mod repeats;
pub use crate::properties::{Property, Parameter, Class, ValueType};
pub use crate::properties::{TodoStatus, EventStatus};
pub use crate::components::{CalendarDateTime, Event, Todo, Component};
pub use crate::calendar::Calendar;
// TODO Calendar TimeZone VTIMEZONE STANDARD DAYLIGHT (see thunderbird exports)
|