pub fn schedule_next(&mut self, now: &DateTime<Tz>) {
        // Don't do anything if we're run out of runs
        if self.run_count == RunCount::Never {
            return;
        }

        // We compute this up front since we can't borrow self immutably while doing this next bit
        let next_run_time = self.next_run_time(now);
        match &mut self.repeat_config {
            Some(RepeatConfig {
                repeats,
                repeats_left,
                repeat_interval,
            }) => {
                if *repeats_left > 0 {
                    *repeats_left -= 1;
                    // Normal scheduling is aligned with the day: if you ask for something every hour, it will
                    // run at the start of the next hour, not one hour after being scheduled.
                    // For repeats, though, we want them aligned the first run of the repeats.
                    // This means we want to align with with next_run (which should be not far in the past),
                    // or if it's somehow unavailable, the current time.
                    // It's possible that we're really far behind. If so, find the next repeat interval that's
                    // still in the future (relative to when we start this run.)
                    let mut next = self.next_run.as_ref().unwrap_or(now).clone();
                    loop {
                        next = repeat_interval.next_from(&next);
                        if next > *now {
                            break;
                        }
                    }
                    self.next_run = Some(next);
                } else {
                    self.next_run = next_run_time;
                    *repeats_left = *repeats;
                }
            }
            None => self.next_run = next_run_time,
        }

        self.last_run = Some(now.clone());
        self.run_count = match self.run_count {
            RunCount::Never => RunCount::Never,
            RunCount::Times(n) if n > 1 => RunCount::Times(n - 1),
            RunCount::Times(_) => RunCount::Never,
            RunCount::Forever => RunCount::Forever,
        };
    }
/// Run a task and re-schedule it. This is usually only called by
/// [Scheduler::run_pending()](::Scheduler::run_pending).
Run a task and re-schedule it.
Run a task and re - schedule it .
pub fn schedule_next(&mut self, now: &DateTime<Tz>) {
        // Don't do anything if we're run out of runs
        if self.run_count == RunCount::Never {
            return;
        }
        // We compute this up front since we can't borrow self immutably while doing this next bit
        let next_run_time = self.next_run_time(now);
        match &mut self.repeat_config {
            Some(RepeatConfig {
                repeats,
                repeats_left,
                repeat_interval,
            }) => {
                if *repeats_left > 0 {
                    *repeats_left -= 1;
                    // Normal scheduling is aligned with the day: if you ask for something every hour, it will
                    // run at the start of the next hour, not one hour after being scheduled.
                    // For repeats, though, we want them aligned the first run of the repeats.
                    // This means we want to align with with next_run (which should be not far in the past),
                    // or if it's somehow unavailable, the current time.
                    // It's possible that we're really far behind. If so, find the next repeat interval that's
                    // still in the future (relative to when we start this run.)
                    let mut next = self.next_run.as_ref().unwrap_or(now).clone();
                    loop {
                        next = repeat_interval.next_from(&next);
                        if next > *now {
                            break;
                        }
                    }
                    self.next_run = Some(next);
                } else {
                    self.next_run = next_run_time;
                    *repeats_left = *repeats;
                }
            }
            None => self.next_run = next_run_time,
        }
        self.last_run = Some(now.clone());
        self.run_count = match self.run_count {
            RunCount::Never => RunCount::Never,
            RunCount::Times(n) if n > 1 => RunCount::Times(n - 1),
            RunCount::Times(_) => RunCount::Never,
            RunCount::Forever => RunCount::Forever,
        };
    }
pub fn schedule_next ( & mut self , now : & DateTime < Tz > ) { // Don't do anything if we're run out of runs if self . run_count == RunCount :: Never { return ; } // We compute this up front since we can't borrow self immutably while doing this next bit let next_run_time = self . next_run_time ( now ) ; match & mut self . repeat_config { Some ( RepeatConfig { repeats , repeats_left , repeat_interval , } ) => { if * repeats_left > 0 { * repeats_left -= 1 ; // Normal scheduling is aligned with the day: if you ask for something every hour, it will // run at the start of the next hour, not one hour after being scheduled. // For repeats, though, we want them aligned the first run of the repeats. // This means we want to align with with next_run (which should be not far in the past), // or if it's somehow unavailable, the current time. // It's possible that we're really far behind. If so, find the next repeat interval that's // still in the future (relative to when we start this run.) let mut next = self . next_run . as_ref ( ) . unwrap_or ( now ) . clone ( ) ; loop { next = repeat_interval . next_from ( & next ) ; if next > * now { break ; } } self . next_run = Some ( next ) ; } else { self . next_run = next_run_time ; * repeats_left = * repeats ; } } None => self . next_run = next_run_time , } self . last_run = Some ( now . clone ( ) ) ; self . run_count = match self . run_count { RunCount :: Never => RunCount :: Never , RunCount :: Times ( n ) if n > 1 => RunCount :: Times ( n - 1 ) , RunCount :: Times ( _ ) => RunCount :: Never , RunCount :: Forever => RunCount :: Forever , } ; }
Run a task and re-schedule it.
Run a task and re - schedule it .
&mut self
now
&DateTime<Tz>