diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 54 |
1 files changed, 27 insertions, 27 deletions
@@ -22,7 +22,7 @@ //! extern crate rrule; //! //! use rrule::build_rruleset; -//! +//! //! // Parse a RRuleSet string, return a RRuleSet type //! let mut rrule = build_rruleset("DTSTART:20120201T023000Z\nRRULE:FREQ=MONTHLY;COUNT=5\nRDATE:20120701T023000Z,20120702T023000Z\nEXRULE:FREQ=MONTHLY;COUNT=2\nEXDATE:20120601T023000Z").unwrap(); //! assert_eq!(rrule.all().len(), 4); @@ -34,13 +34,13 @@ //! //! ``` //! extern crate rrule; -//! extern crate chrono; -//! extern crate chrono_tz; +//! extern crate chrono; +//! extern crate chrono_tz; //! //! use chrono::prelude::*; //! use chrono_tz::UTC; //! use rrule::{RRule, RRuleSet, Options, Frequenzy, Weekday}; -//! +//! //! // Build options that starts first day in 2020 at 9:00AM and occurs daily 5 times //! let mut options = Options::new() //! .dtstart(UTC.ymd(2020, 1, 1).and_hms(9, 0, 0)) @@ -48,8 +48,8 @@ //! .freq(Frequenzy::Daily) //! .build() //! .unwrap(); -//! -//! // Construct `RRule` from options +//! +//! // Construct `RRule` from options //! let mut rrule = RRule::new(options); //! let occurences = rrule.all(); //! for i in 0..5 { @@ -78,8 +78,8 @@ //! .byweekday(vec![Weekday::Tue, Weekday::Wed]) //! .build() //! .unwrap(); -//! -//! // Construct `RRule` from options +//! +//! // Construct `RRule` from options //! let mut rrule = RRule::new(rrule_options); //! //! @@ -91,21 +91,21 @@ //! .byweekday(vec![Weekday::Wed]) //! .build() //! .unwrap(); -//! -//! // Construct `RRule` from options +//! +//! // Construct `RRule` from options //! let mut exrule = RRule::new(exrule_options); //! //! // Now create the RRuleSet and add rrule and exrule //! let mut rrule_set = RRuleSet::new(); //! rrule_set.rrule(rrule); //! rrule_set.exrule(exrule); -//! +//! //! let occurences = rrule_set.all(); //! //! for occurence in &occurences { //! assert_eq!(occurence.weekday(), Weekday::Tue); //! } -//! +//! //! assert_eq!(occurences.len(), 2); //! ``` //! @@ -116,8 +116,8 @@ //! //! ``` //! extern crate rrule; -//! extern crate chrono; -//! extern crate chrono_tz; +//! extern crate chrono; +//! extern crate chrono_tz; //! //! use chrono::prelude::*; //! use chrono_tz::{UTC, Tz}; @@ -125,13 +125,13 @@ //! use rrule::{RRule, RRuleSet, Options, Frequenzy, Weekday}; //! //! // SOME NOTES: -//! // Occurences produces by RRule or RRuleSet will be in the same timezone -//! // as the start datetime provided (dtstart). The `until` datetime MUST +//! // Occurences produces by RRule or RRuleSet will be in the same timezone +//! // as the start datetime provided (dtstart). The `until` datetime MUST //! // always be specified with the UTC timezone if it is specified. //! // Example: -//! // The following examples uses an RRuleSet with an RRule that yields occurences -//! // in the Europe/Berlin timezone, and contains one EXDATE that is specified +//! // The following examples uses an RRuleSet with an RRule that yields occurences +//! // in the Europe/Berlin timezone, and contains one EXDATE that is specified //! // in UTC and collides (and therefore filters away) with one of those occurences. //! //! @@ -142,25 +142,25 @@ //! .freq(Frequenzy::Daily) //! .build() //! .unwrap(); -//! +//! //! let mut rrule = RRule::new(rrule_options); //! -//! // Exdate in the UTC at 8 oclock which is 9 oclock in Berlin and therefore +//! // Exdate in the UTC at 8 oclock which is 9 oclock in Berlin and therefore //! // collides with one of the rrule occurences. //! let exdate = UTC.ymd(2020, 1, 2).and_hms(8, 0, 0); -//! +//! //! // Now create the RRuleSet and add rrule and exdate //! let mut rrule_set = RRuleSet::new(); //! rrule_set.rrule(rrule); //! rrule_set.exdate(exdate); -//! +//! //! let occurences = rrule_set.all(); //! // RRule contained 4 occurences but 1 was filtered away by the exdate //! assert_eq!(occurences.len(), 3); //! //! // If you want to get back the DateTimes in another timezone (In this case Moscow). //! // Refer to the chrono and chrono-tz crates for more documentation on how to work with -//! // their DateTime type and timezones. +//! // their DateTime type and timezones. //! let occurences_in_moscow_tz: Vec<DateTime<Tz>> = occurences.iter() //! .map(|d| d.with_timezone(&Moscow)).collect(); //! ``` @@ -172,16 +172,16 @@ extern crate regex; mod datetime; mod iter; -mod parse_options; mod options; -mod rrulestr; +mod parse_options; mod rrule; mod rrule_iter; mod rruleset; mod rruleset_iter; +mod rrulestr; +pub use crate::options::{Frequenzy, Options, ParsedOptions}; pub use crate::rrule::RRule; pub use crate::rruleset::RRuleSet; pub use crate::rrulestr::{build_rrule, build_rruleset}; -pub use crate::options::{Frequenzy, ParsedOptions, Options}; -pub use chrono::Weekday;
\ No newline at end of file +pub use chrono::Weekday; |