Merge pull request #23 from gma2th/master

Implement Error trait for ParseError
pull/25/head
bspeice 2020-06-11 12:13:12 -04:00 committed by GitHub
commit 5782a573bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -90,6 +90,8 @@ use rust_decimal::Decimal;
use rust_decimal::Error as DecimalError;
use std::cmp::min;
use std::collections::HashMap;
use std::error::Error;
use std::fmt;
use std::num::ParseIntError;
use std::str::FromStr;
use std::vec::Vec;
@ -146,6 +148,14 @@ pub enum ParseError {
YearMonthDayError(&'static str),
}
impl fmt::Display for ParseError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self)
}
}
impl Error for ParseError {}
type ParseResult<I> = Result<I, ParseError>;
pub(crate) fn tokenize(parse_string: &str) -> Vec<String> {