mirror of
https://github.com/bspeice/dtparse
synced 2024-12-22 04:18:09 -05:00
Implement Error trait for ParseError
This commit is contained in:
parent
e9c994a755
commit
e895fbd9f3
10
src/lib.rs
10
src/lib.rs
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user