diff options
Diffstat (limited to 'src/rruleset.rs')
-rw-r--r-- | src/rruleset.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rruleset.rs b/src/rruleset.rs index 4bea086..e8ddf11 100644 --- a/src/rruleset.rs +++ b/src/rruleset.rs @@ -1,8 +1,11 @@ use crate::datetime::DTime; +use crate::options::RRuleParseError; use crate::rrule::RRule; use crate::rruleset_iter::RRuleSetIter; +use crate::rrulestr::build_rruleset; use chrono::prelude::*; use chrono_tz::{Tz, UTC}; +use std::str::FromStr; #[derive(Debug)] pub struct RRuleSet { @@ -87,6 +90,14 @@ impl RRuleSet { } } +impl FromStr for RRuleSet { + type Err = RRuleParseError; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + build_rruleset(s) + } +} + #[cfg(test)] mod test_iter_set { use super::*; |