diff options
author | Hendrik Sollich <hendrik@hoodie.de> | 2016-11-12 00:09:53 +0100 |
---|---|---|
committer | Hendrik Sollich <hendrik@hoodie.de> | 2016-11-12 00:15:32 +0100 |
commit | e2e60eb0ff6651f9b372d9381e24c9944be68574 (patch) | |
tree | eca4951554b29ffecdc1393f5ada23ba89dabc76 /src | |
parent | c531f1858fcf7169a93d2bfcee02f4a0b968227a (diff) |
added documentation
Diffstat (limited to 'src')
-rw-r--r-- | src/components.rs | 13 | ||||
-rw-r--r-- | src/lib.rs | 65 |
2 files changed, 50 insertions, 28 deletions
diff --git a/src/components.rs b/src/components.rs index f61a647..2a1307f 100644 --- a/src/components.rs +++ b/src/components.rs @@ -6,7 +6,6 @@ use std::fmt; use std::mem; use std::collections::HashMap; -use repeats::*; use properties::*; /// VEVENT [(RFC 5545, Section 3.6.1 )](https://tools.ietf.org/html/rfc5545#section-3.6.1) @@ -27,9 +26,9 @@ impl Event { } - pub fn repeats<R:Repeater+?Sized>(&mut self, repeat: R) -> &mut Self { - unimplemented!() - } + //pub fn repeats<R:Repeater+?Sized>(&mut self, repeat: R) -> &mut Self { + // unimplemented!() + //} } @@ -42,9 +41,9 @@ impl Todo { Todo { properties: mem::replace(&mut self.properties, HashMap::new()) } } - pub fn repeats<R:Repeater+?Sized>(&mut self, repeat: R) -> &mut Self { - unimplemented!() - } + //pub fn repeats<R:Repeater+?Sized>(&mut self, repeat: R) -> &mut Self { + // unimplemented!() + //} } @@ -7,38 +7,61 @@ //! * `Component`s are e.g. `Event` or `Todo` //! * `Component`s consist of `Property`s //! * `Property`s may have `Parameter`s - -#![allow(unused_variables)] +//! +//! ```rust +//! # extern crate chrono; +//! # extern crate icalendar; +//! # extern crate vobject; +//! # use chrono::*; +//! # use icalendar::*; +//! 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(); +//! +//! +//! vobject::parse_component(&bday.to_string()).unwrap(); +//! vobject::parse_component(&todo.to_string()).unwrap(); +//! vobject::parse_component(&event.to_string()).unwrap(); +//! +//! let mut calendar = Calendar::new(); +//! calendar.add(event); +//! calendar.add(todo); +//! calendar.add(bday); +//! +//! ``` extern crate chrono; extern crate uuid; -extern crate vobject; +//extern crate vobject; //pub mod period; mod components; mod properties; mod calendar; -pub mod repeats; +//pub mod repeats; pub use properties::{Property, Parameter, Class, ValueType}; //pub use components::{event, todo}; pub use components::{Event, Todo, Component}; pub use calendar::Calendar; -#[test] -fn it_works() { - let birthday = Event::new("My Birthday").done(); - //let birthday = Event::new("My Birthday").repeats(Annually).done(); - //let birthday = Event::new("My Birthday").every(15.days()).done(); - println!("{:#?}", birthday); -} - -//BEGIN:VEVENT -//DTSTAMP:20161028T133924Z -//UID:ba95bf93-f816-434c-8759-f05a2345b575 -//DTSTART:20161021T170000 -//DTEND:20161021T140000 -//DESCRIPTION: this\n is\n the description. -//SUMMARY:Hackathon Planworx -//END:VEVENT - |