fn generate_ranges(
        &self,
        start: DateTime<Utc>,
        end: DateTime<Utc>,
    ) -> Vec<Range<DateTime<Utc>>> {
        let mut all_ranges: Vec<Range<_>> = vec![];

        let mut period_start = start;
        let mut period_ranges = self.with_start(start).ranges().clone();

        while period_start < end {
            for mut range in &mut period_ranges {
                if range.start > end {
                    break;
                }
                // The temporary boolean here is necessary here since we don't have "if let" chains
                // at the time of writing
                let mut added = false;
                if let Some(last) = all_ranges.last_mut() {
                    if last.end == range.start {
                        last.end = range.end;
                        added = true;
                    }
                }
                if !added {
                    if range.end > end {
                        all_ranges.push(range.start..end);
                        break;
                    } else {
                        all_ranges.push(range.clone());
                    }
                }
                range.start = range.start + self.period();
                range.end = range.end + self.period();
            }
            period_start = period_start + self.period();
        }

        all_ranges
    }
/// Generates all the time ranges that the time segment covers between the
/// given start and end time.
Generates all the time ranges that the time segment covers between the
given start and end time.
Generates all the time ranges that the time segment covers between the given start and end time .
fn generate_ranges(
        &self,
        start: DateTime<Utc>,
        end: DateTime<Utc>,
    ) -> Vec<Range<DateTime<Utc>>> {
        let mut all_ranges: Vec<Range<_>> = vec![];
        let mut period_start = start;
        let mut period_ranges = self.with_start(start).ranges().clone();
        while period_start < end {
            for mut range in &mut period_ranges {
                if range.start > end {
                    break;
                }
                // The temporary boolean here is necessary here since we don't have "if let" chains
                // at the time of writing
                let mut added = false;
                if let Some(last) = all_ranges.last_mut() {
                    if last.end == range.start {
                        last.end = range.end;
                        added = true;
                    }
                }
                if !added {
                    if range.end > end {
                        all_ranges.push(range.start..end);
                        break;
                    } else {
                        all_ranges.push(range.clone());
                    }
                }
                range.start = range.start + self.period();
                range.end = range.end + self.period();
            }
            period_start = period_start + self.period();
        }
        all_ranges
    }
fn generate_ranges ( & self , start : DateTime < Utc > , end : DateTime < Utc > , ) -> Vec < Range < DateTime < Utc > > > { let mut all_ranges : Vec < Range < _ > > = vec ! [ ] ; let mut period_start = start ; let mut period_ranges = self . with_start ( start ) . ranges ( ) . clone ( ) ; while period_start < end { for mut range in & mut period_ranges { if range . start > end { break ; } // The temporary boolean here is necessary here since we don't have "if let" chains // at the time of writing let mut added = false ; if let Some ( last ) = all_ranges . last_mut ( ) { if last . end == range . start { last . end = range . end ; added = true ; } } if ! added { if range . end > end { all_ranges . push ( range . start .. end ) ; break ; } else { all_ranges . push ( range . clone ( ) ) ; } } range . start = range . start + self . period ( ) ; range . end = range . end + self . period ( ) ; } period_start = period_start + self . period ( ) ; } all_ranges }
Generates all the time ranges that the time segment covers between the
given start and end time.
Generates all the time ranges that the time segment covers between the given start and end time .
&self
start
DateTime<Utc>
end
DateTime<Utc>
&self
start
DateTime<Utc>
end
DateTime<Utc>