Added error handler.
[?]
CrEcTsRjb1hHQjHuumqRfqdbVV4X58iLEubi4noaDPFa
Aug 3, 2021, 5:41 AM
X2POHOVL2YB5G4GQZ3NO2HRFBZV3ANDWUIZW34GQXEI56AXSHO3ACDependencies
- [2]
NLFSLCBOAdded in-place mut_range() and range(). - [3]
QYLGEDIVFirst record. - [4]
XCCNAGMZCreated with_range() fn on RegularTimeSeries. - [5]
YMV7RPQ5Improved csv reading and cleanup up serialization. - [6]
TD7KX2PIAdded year-on-year transform. - [7]
XIWTRGR6Prepare to make external iterator for TimeSeries. - [8]
VGDNIY33Added error source locations. - [9]
IYW574EKCreated RegularTimeSeriesIter.
Change contents
- edit in src/lib.rs at line 1[3.57]→[3.0:128](∅→∅),[3.16]→[3.0:128](∅→∅),[3.128]→[3.45:46](∅→∅),[3.45]→[3.45:46](∅→∅),[3.46]→[3.58:62](∅→∅)
//! A time-series abstraction. A date of with granularity in months or larger associated with a//! numeric array of any size./// - replacement in src/lib.rs at line 20
/// A duration between two `MonthlyDates`./// A duration between two `Months`. - edit in src/lib.rs at line 49
impl fmt::Display for Duration {fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {let mut s = String::new();match self.0 {1 => s.push_str("1 month"),n => {s.push_str(&n.to_string());s.push_str(" months");},};write!(f, "{}", s)}} - replacement in src/lib.rs at line 192
let year = match line[..4].parse() {Ok(y) => y,Err(_) => {return Err(parse_csv_date_failed(let year = line[..4].parse().map_err(|_| {parse_csv_date_failed( - replacement in src/lib.rs at line 200
))},};)})?; - replacement in src/lib.rs at line 203
let month = match line[5..7].parse() {Ok(m) => m,Err(_) => {return Err(parse_csv_date_failed(let month = line[5..7].parse().map_err(|_| {parse_csv_date_failed( - replacement in src/lib.rs at line 211
))},};)})?; - replacement in src/lib.rs at line 214
let value = match line[12..].parse::<f32>() {Ok(value) => value,Err(_) => {return Err(parse_csv_value_failed(let value = line[12..].parse::<f32>().map_err(|_| {parse_csv_value_failed( - replacement in src/lib.rs at line 222
))},};)})?; - edit in src/lib.rs at line 236
// /// Return true if the durations between Points are all equal.// pub fn is_regular(&self, duration: &MonthlyDate) -> bool {// if self.len < 2 {// return false// } else {// self.0.as_slice().windows(2).all(|datapoint_pair| {// datapoint_pair[1].date() - datapoint_pair[0].date() == *duration// })// }// } - replacement in src/lib.rs at line 238
- replacement in src/lib.rs at line 360
pub fn zip_one_one(self, other: RegularTimeSeries<1>) -> RegularTimeSeries<2> {pub fn zip_one_one(self, other: RegularTimeSeries<1>) -> Result<RegularTimeSeries<2>, Error> { - replacement in src/lib.rs at line 365
if self.duration() != other.duration() { panic!() };if self.duration() != other.duration() {return Err(expected_same_durations(file!(),line!(),&self.duration().to_string(),&other.duration().to_string(),));}; - replacement in src/lib.rs at line 390
TimeSeries::<2>::new(v).try_into().unwrap()TimeSeries::<2>::new(v).try_into() - edit in src/lib.rs at line 476
- edit in src/lib.rs at line 477
- edit in src/lib.rs at line 486
let index = (date.as_isize() - self.first_date().as_isize()) / self.duration.0; - edit in src/lib.rs at line 488
let index = date.as_isize() - self.first_date().as_isize() / self.duration.0; - edit in src/lib.rs at line 579
- edit in src/lib.rs at line 582
- edit in src/lib.rs at line 722[3.10469]
- replacement in src/error.rs at line 30
///pub fn expected_same_durations(code_file: &str,code_line: u32,first_duration: &str,second_duration: &str) -> Error{Error(format!("[time_series:02:{}:{}] Expected time-series to have same duration but had [{}] and [{}].",code_file,code_line,first_duration,second_duration,))}