diff options
author | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-11-01 22:36:38 +0100 |
---|---|---|
committer | Fredrik Meringdal <fmeringdal@hotmail.com> | 2020-11-01 22:36:38 +0100 |
commit | 000c7c9900cbe93f5a72bbbef3ad4eaa3906b132 (patch) | |
tree | e74d1bfe48f446f75a00dac875988a71d47fb1b4 /src/rruleset.rs | |
parent | ed603b788b23535b086f2a7491627e018e8dce5d (diff) | |
download | rust_rrule-000c7c9900cbe93f5a72bbbef3ad4eaa3906b132.zip |
FromStr impl for RRule and RRuleSet + docs
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::*; |