diff options
author | metamuffin <yvchraiqi@protonmail.com> | 2022-06-11 18:55:54 +0200 |
---|---|---|
committer | metamuffin <yvchraiqi@protonmail.com> | 2022-06-11 18:55:54 +0200 |
commit | 163052cd25d927c9437a2234befd22c9d143c4d4 (patch) | |
tree | 5181ce8ee7755024cba77d3172c637ff0e7c59df /karld/src/helper.rs | |
parent | ea37afe9ae9a1607fa3b6f365b9307c579c45b8d (diff) | |
download | karlender-163052cd25d927c9437a2234befd22c9d143c4d4.tar karlender-163052cd25d927c9437a2234befd22c9d143c4d4.tar.bz2 karlender-163052cd25d927c9437a2234befd22c9d143c4d4.tar.zst |
redundant Instance
Diffstat (limited to 'karld/src/helper.rs')
-rw-r--r-- | karld/src/helper.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/karld/src/helper.rs b/karld/src/helper.rs index 2e601b0..f106df6 100644 --- a/karld/src/helper.rs +++ b/karld/src/helper.rs @@ -1,5 +1,5 @@ use crate::condition::{ConditionFind, Direction, Edge}; -use chrono::{NaiveDate, NaiveDateTime}; +use chrono::NaiveDateTime; use karlcommon::{Schedule, Task}; use std::{collections::HashMap, ops::Range}; @@ -34,9 +34,17 @@ impl DiscreteCacheTask { } pub fn find(&mut self, from: NaiveDateTime, dir: Direction) -> Range<Option<NaiveDateTime>> { - assert_eq!(dir, Direction::Forward); // TODO cache // if let Some(c) = self.cached {} + return self.find_uncached(from, dir); + } + + pub fn find_uncached( + &mut self, + from: NaiveDateTime, + dir: Direction, + ) -> Range<Option<NaiveDateTime>> { + assert_eq!(dir, Direction::Forward); // TODO undefined behaviour if dir is not forward (maybe it even works backward) match &self.inner.schedule { Schedule::Condition(o) => { let start = o.find(Edge::Start, dir, from); |