mirror of
https://github.com/bspeice/dtparse
synced 2026-06-07 05:41:52 -04:00
Implement Error trait for ParseError
This commit is contained in:
+10
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user