pub fn index_at(&self, date: Date) -> Option<usize> {
        if !self.range.contains(date) {
            return None;
        }
        let tmp_range = DateRange::new(self.range.from, date);
        match self.periodicity {
            Period::Day => Some(tmp_range.as_days() as usize),
            Period::Week => Some(tmp_range.as_weeks(false) as usize),
            Period::Month => Some(tmp_range.as_months(false) as usize),
            Period::Quarter => Some(tmp_range.as_quarters(false) as usize),
            Period::Year => Some(tmp_range.as_years(false) as usize),
        }
    }
// region: indexing
/// Return the index position of the date within the
/// timeline. Returns None if the date is outside of
/// the timeline
indexing
Return the index position of the date within the
timeline. Returns None if the date is outside of
the timeline
indexing Return the index position of the date within the timeline . Returns None if the date is outside of the timeline
pub fn index_at(&self, date: Date) -> Option<usize> {
        if !self.range.contains(date) {
            return None;
        }
        let tmp_range = DateRange::new(self.range.from, date);
        match self.periodicity {
            Period::Day => Some(tmp_range.as_days() as usize),
            Period::Week => Some(tmp_range.as_weeks(false) as usize),
            Period::Month => Some(tmp_range.as_months(false) as usize),
            Period::Quarter => Some(tmp_range.as_quarters(false) as usize),
            Period::Year => Some(tmp_range.as_years(false) as usize),
        }
    }
pub fn index_at ( & self , date : Date ) -> Option < usize > { if ! self . range . contains ( date ) { return None ; } let tmp_range = DateRange :: new ( self . range . from , date ) ; match self . periodicity { Period :: Day => Some ( tmp_range . as_days ( ) as usize ) , Period :: Week => Some ( tmp_range . as_weeks ( false ) as usize ) , Period :: Month => Some ( tmp_range . as_months ( false ) as usize ) , Period :: Quarter => Some ( tmp_range . as_quarters ( false ) as usize ) , Period :: Year => Some ( tmp_range . as_years ( false ) as usize ) , } }
region: indexing
Return the index position of the date within the
timeline.
region : indexing Return the index position of the date within the timeline .
&self
date
Date
&self
date
Date