pub fn next_window_minute_in_week(
        &self,
        datetime: &DateTime<impl TimeZone>,
    ) -> Option<MinuteInWeek> {
        if self.is_empty() {
            return None;
        }

        // Already in a window, return now.
        if self.contains_datetime(datetime) {
            return Some(utils::datetime_as_weekly_minute(datetime));
        }

        let timepoint = utils::datetime_as_weekly_minute(datetime);
        // Next window is this week.
        if let Some(next) = self
            .windows
            .iter_sorted()
            .find(|x| x.range.start >= timepoint)
        {
            let next_minute_in_week = next.range.start;
            return Some(next_minute_in_week);
        };

        // Next window is not this week.
        let first_window_next_week = self
            .windows
            .iter_sorted()
            .next()
            .expect("unexpected empty weekly calendar")
            .range
            .start;
        Some(first_window_next_week)
    }
/// Return the minutes since the beginning of the week of the next window
/// containing the given datetime.
///
/// This returns `None` if no windows are reachable.
Return the minutes since the beginning of the week of the next window
containing the given datetime.

This returns `None` if no windows are reachable.
Return the minutes since the beginning of the week of the next window containing the given datetime . This returns ` None ` if no windows are reachable .
pub fn next_window_minute_in_week(
        &self,
        datetime: &DateTime<impl TimeZone>,
    ) -> Option<MinuteInWeek> {
        if self.is_empty() {
            return None;
        }
        // Already in a window, return now.
        if self.contains_datetime(datetime) {
            return Some(utils::datetime_as_weekly_minute(datetime));
        }
        let timepoint = utils::datetime_as_weekly_minute(datetime);
        // Next window is this week.
        if let Some(next) = self
            .windows
            .iter_sorted()
            .find(|x| x.range.start >= timepoint)
        {
            let next_minute_in_week = next.range.start;
            return Some(next_minute_in_week);
        };
        // Next window is not this week.
        let first_window_next_week = self
            .windows
            .iter_sorted()
            .next()
            .expect("unexpected empty weekly calendar")
            .range
            .start;
        Some(first_window_next_week)
    }
pub fn next_window_minute_in_week ( & self , datetime : & DateTime < impl TimeZone > , ) -> Option < MinuteInWeek > { if self . is_empty ( ) { return None ; } // Already in a window, return now. if self . contains_datetime ( datetime ) { return Some ( utils :: datetime_as_weekly_minute ( datetime ) ) ; } let timepoint = utils :: datetime_as_weekly_minute ( datetime ) ; // Next window is this week. if let Some ( next ) = self . windows . iter_sorted ( ) . find ( | x | x . range . start >= timepoint ) { let next_minute_in_week = next . range . start ; return Some ( next_minute_in_week ) ; } ; // Next window is not this week. let first_window_next_week = self . windows . iter_sorted ( ) . next ( ) . expect ( " " ) . range . start ; Some ( first_window_next_week ) }
Return the minutes since the beginning of the week of the next window
containing the given datetime.
Return the minutes since the beginning of the week of the next window containing the given datetime .
&self
datetime
&DateTime<impl TimeZone>