NLFSLCBOGCQYI2DQXLO5AWBBRABDS26NIX6HGUGO2KQG2OHQGWOQC VGDNIY332BPU4XV76EWOXVLXBZ5E6RXXT7JRWJYDVFBLUFT6U6KAC TD7KX2PIGP2TCZ2Q7XXNBBDJIQ2KXEIFWLBMWXTJE3OEXVV4L7MAC QYLGEDIVYSUHAYU7ZLUZDA6OULFDDZYTQN264V3473MEXLFZ4U3AC IYW574EKVRH2QJ7GFNX4FMCNI7EMLNYYIC6NGHVIJVDEWSDL42GQC YMV7RPQ5TFBETNHRMS26MGHJXEAYRMIF4F7Z6ITGRCG65TOGSNDAC XCCNAGMZBU6N3YNH3ILES46HV6HBSSCSO52CK5ZQNYIYNSDCHXIAC XIWTRGR6SRVSX3TA6YZVMZIETMZNLJBQSJ3BAL3O6ZXURJPTHQZAC /// A `RegularTimeSeries` has an additional requirements over `TimeSeries` in the time interval/// between successive `DatePoints` has the same `Duration`. This also ensures ordering. A/// `RegularTimeSeries` is guaranteed to have two or more data points.
/// A time-series with regular, contiguous data.////// A `RegularTimeSeries` is guaranteed to have two or more data points.
}}// Return a new `RegularTimeSeries` with a new date range.impl<const N: usize> RegularTimeSeries<N> {/// Remove `DatePoints` outside `date_range` from `Self`.pub fn range(&self, date_range: &DateRange) -> RegularTimeSeries<N> {let start_date = match date_range.start_date {None => self.ts.0.first().unwrap().date(),Some(start) => start,};let end_date = match date_range.end_date {None => self.ts.0.last().unwrap().date(),Some(end) => end,};let mut ts = TimeSeries::new(Vec::new());for dp in self.ts.0.iter() {if dp.date() >= start_date && dp.date() <= end_date {ts.0.push(*dp)};}ts.try_into().unwrap()
/// A `DateRange` is used to constrain a `TimeSeries` iterator over a range of dates. If/// `start_date` or `end_date` are `None` then the iterator will start at the first value in the/// `TimeSeries` or end at the last value in the `TimeSeries` respectively.#[derive(Clone, Copy, Debug)]
/// Specifies the time-span of the data.#[derive(Clone, Copy, Debug, Serialize)]