aboutsummaryrefslogtreecommitdiff
path: root/src/periodic.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/periodic.rs')
-rw-r--r--src/periodic.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/periodic.rs b/src/periodic.rs
index b4bf7bf..0c52a9b 100644
--- a/src/periodic.rs
+++ b/src/periodic.rs
@@ -12,8 +12,8 @@ pub struct Periodic {
pub event: Event,
pub freq: Freq,
pub interval: i64,
- pub count: i64,
- pub until: Date,
+ pub count: Option<i64>,
+ pub until: Option<Date>,
}
#[derive(Debug)]
@@ -33,8 +33,8 @@ impl Periodic {
event: Event::new(),
freq: Freq::Secondly,
interval: 1,
- until: Date::empty(),
- count: 0,
+ count: None,
+ until: None,
}
}
@@ -42,8 +42,8 @@ impl Periodic {
match param {
"FREQ" => self.freq = value.parse()?,
"INTERVAL" => self.interval = value.parse()?,
- "COUNT" => self.count = value.parse()?,
- "UNTIL" => self.until = Date::parse(&value, "")?,
+ "COUNT" => self.count = Some(value.parse()?),
+ "UNTIL" => self.until = Some(Date::parse(&value, "")?),
_ => (),
}
Ok(())
@@ -55,8 +55,8 @@ impl Periodic {
let mut events = Vec::new();
let mut count = 0;
while start <= *last {
- if (!self.until.is_empty() && start <= self.until) ||
- (count != 0 && count >= self.count)
+ if (self.until.is_some() && start <= self.until.unwrap()) ||
+ (self.count.is_some() && count >= self.count.unwrap())
{
break;
}