Struct clockwork_cron::Schedule
source · pub struct Schedule { /* private fields */ }Implementations§
source§impl Schedule
impl Schedule
sourcepub fn next_after<Z>(&self, after: &DateTime<Z>) -> Option<DateTime<Z>>where
Z: TimeZone,
pub fn next_after<Z>(&self, after: &DateTime<Z>) -> Option<DateTime<Z>>where
Z: TimeZone,
Examples found in repository?
src/schedule.rs (line 413)
409 410 411 412 413 414 415 416 417 418 419 420
fn next(&mut self) -> Option<DateTime<Z>> {
if self.is_done {
return None;
}
if let Some(next_datetime) = self.schedule.next_after(&self.previous_datetime) {
self.previous_datetime = next_datetime.clone();
Some(next_datetime)
} else {
self.is_done = true;
None
}
}sourcepub fn prev_before<Z>(&self, before: &DateTime<Z>) -> Option<DateTime<Z>>where
Z: TimeZone,
pub fn prev_before<Z>(&self, before: &DateTime<Z>) -> Option<DateTime<Z>>where
Z: TimeZone,
Examples found in repository?
src/schedule.rs (line 432)
427 428 429 430 431 432 433 434 435 436 437 438 439
fn next_back(&mut self) -> Option<Self::Item> {
if self.is_done {
return None;
}
if let Some(prev_datetime) = self.schedule.prev_before(&self.previous_datetime) {
self.previous_datetime = prev_datetime.clone();
Some(prev_datetime)
} else {
self.is_done = true;
None
}
}sourcepub fn after<Z>(&self, after: &DateTime<Z>) -> ScheduleIterator<'_, Z>where
Z: TimeZone,
pub fn after<Z>(&self, after: &DateTime<Z>) -> ScheduleIterator<'_, Z>where
Z: TimeZone,
Like the upcoming method, but allows you to specify a start time other than the present.
pub fn includes<Z>(&self, date_time: DateTime<Z>) -> boolwhere
Z: TimeZone,
sourcepub fn years(&self) -> &impl TimeUnitSpec
pub fn years(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the years included in this Schedule.
sourcepub fn months(&self) -> &impl TimeUnitSpec
pub fn months(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the months of the year included in this Schedule.
sourcepub fn days_of_month(&self) -> &impl TimeUnitSpec
pub fn days_of_month(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the days of the month included in this Schedule.
sourcepub fn days_of_week(&self) -> &impl TimeUnitSpec
pub fn days_of_week(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the days of the week included in this Schedule.
sourcepub fn hours(&self) -> &impl TimeUnitSpec
pub fn hours(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the hours of the day included in this Schedule.
sourcepub fn minutes(&self) -> &impl TimeUnitSpec
pub fn minutes(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the minutes of the hour included in this Schedule.
sourcepub fn seconds(&self) -> &impl TimeUnitSpec
pub fn seconds(&self) -> &impl TimeUnitSpec
Returns a TimeUnitSpec describing the seconds of the minute included in this Schedule.