diff options
author | Fredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local> | 2021-02-03 23:52:36 +0100 |
---|---|---|
committer | Fredrik Meringdal <fredrikmeringdal@Fredriks-MacBook-Pro.local> | 2021-02-03 23:52:36 +0100 |
commit | 25f12db8c239fb0133418e4869a1482ef9840add (patch) | |
tree | 00c6f36a446252eeadd86b73196a1ca35fd40b2f | |
parent | c76c0c9221181afd8e08dbed2a784a35a5e129f4 (diff) | |
download | rust_rrule-25f12db8c239fb0133418e4869a1482ef9840add.zip |
better api
-rw-r--r-- | src/rrule.rs | 8 | ||||
-rw-r--r-- | src/rruleset.rs | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/rrule.rs b/src/rrule.rs index aa000d1..7ac6016 100644 --- a/src/rrule.rs +++ b/src/rrule.rs @@ -15,14 +15,14 @@ impl RRule { } /// Returns all the recurrences of the rrule - pub fn all(&mut self) -> Vec<DateTime<Tz>> { + pub fn all(&self) -> Vec<DateTime<Tz>> { self.clone().into_iter().collect() } /// Returns the last recurrence before the given datetime instance. /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. - pub fn before(&mut self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { + pub fn before(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { self.clone() .into_iter() .take_while(|d| if inc { *d <= dt } else { *d < dt }) @@ -32,7 +32,7 @@ impl RRule { /// Returns the last recurrence after the given datetime instance. /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. - pub fn after(&mut self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { + pub fn after(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { self.clone() .into_iter() .skip_while(|d| if inc { *d <= dt } else { *d < dt }) @@ -44,7 +44,7 @@ impl RRule { /// themselves recurrences. With inc == true, they will be included in the /// list, if they are found in the recurrence set. pub fn between( - &mut self, + &self, after: DateTime<Tz>, before: DateTime<Tz>, inc: bool, diff --git a/src/rruleset.rs b/src/rruleset.rs index 4ae7c41..c194744 100644 --- a/src/rruleset.rs +++ b/src/rruleset.rs @@ -43,14 +43,14 @@ impl RRuleSet { } /// Returns all the recurrences of the rruleset - pub fn all(&mut self) -> Vec<DateTime<Tz>> { + pub fn all(&self) -> Vec<DateTime<Tz>> { self.clone().into_iter().collect() } /// Returns the last recurrence before the given datetime instance. /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. - pub fn before(&mut self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { + pub fn before(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { self.clone() .into_iter() .take_while(|d| if inc { *d <= dt } else { *d < dt }) @@ -60,7 +60,7 @@ impl RRuleSet { /// Returns the last recurrence after the given datetime instance. /// The inc keyword defines what happens if dt is an recurrence. /// With inc == true, if dt itself is an recurrence, it will be returned. - pub fn after(&mut self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { + pub fn after(&self, dt: DateTime<Tz>, inc: bool) -> Option<DateTime<Tz>> { self.clone() .into_iter() .skip_while(|d| if inc { *d <= dt } else { *d < dt }) @@ -72,7 +72,7 @@ impl RRuleSet { /// themselves recurrences. With inc == true, they will be included in the /// list, if they are found in the recurrence set. pub fn between( - &mut self, + &self, after: DateTime<Tz>, before: DateTime<Tz>, inc: bool, |