summaryrefslogtreecommitdiff
path: root/src/rruleset.rs
diff options
context:
space:
mode:
authorFredrik Meringdal <fmeringdal@hotmail.com>2020-11-01 22:36:38 +0100
committerFredrik Meringdal <fmeringdal@hotmail.com>2020-11-01 22:36:38 +0100
commit000c7c9900cbe93f5a72bbbef3ad4eaa3906b132 (patch)
treee74d1bfe48f446f75a00dac875988a71d47fb1b4 /src/rruleset.rs
parented603b788b23535b086f2a7491627e018e8dce5d (diff)
downloadrust_rrule-000c7c9900cbe93f5a72bbbef3ad4eaa3906b132.zip
FromStr impl for RRule and RRuleSet + docs
Diffstat (limited to 'src/rruleset.rs')
-rw-r--r--src/rruleset.rs11
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::*;