summaryrefslogtreecommitdiffstats
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/iterator.rs6
-rw-r--r--src/parser/mod.rs8
-rw-r--r--src/parser/timetype.rs16
3 files changed, 15 insertions, 15 deletions
diff --git a/src/parser/iterator.rs b/src/parser/iterator.rs
index a60892e..8661646 100644
--- a/src/parser/iterator.rs
+++ b/src/parser/iterator.rs
@@ -1,7 +1,7 @@
use nom::whitespace::sp;
-use failure::Fallible as Result;
-use failure::Error;
+use error::Result;
+use error::Error;
use parser::timetype::*;
use timetype::IntoTimeType;
use timetype;
@@ -93,7 +93,7 @@ impl Iterator {
let into_ndt = |e: timetype::TimeType| try!(e.calculate())
.get_moment()
- .ok_or(error::ErrorKind::NotADateInsideIterator)
+ .ok_or(Error::NotADateInsideIterator)
.map_err(Error::from)
.map(Clone::clone);
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index c6483b4..88d0020 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -49,8 +49,8 @@ use nom::IResult;
mod timetype;
mod iterator;
-use failure::Fallible as Result;
-use error::ErrorKind as KEK;
+use error::Result;
+use error::Error;
use iter::Iter;
use timetype::IntoTimeType;
use parser::timetype::timetype;
@@ -71,8 +71,8 @@ pub fn parse(s: &str) -> Result<Parsed> {
IResult::Done(_, Ok(o)) => Ok(o),
IResult::Done(_, Err(e)) => Err(e),
IResult::Error(e) => Err(e).map_err(From::from),
- IResult::Incomplete(Needed::Unknown) => Err(KEK::UnknownParserError.into()),
- IResult::Incomplete(Needed::Size(_)) => Err(KEK::UnknownParserError.into()),
+ IResult::Incomplete(Needed::Unknown) => Err(Error::UnknownParserError),
+ IResult::Incomplete(Needed::Size(_)) => Err(Error::UnknownParserError),
}
}
diff --git a/src/parser/timetype.rs b/src/parser/timetype.rs
index 13f111b..1437242 100644
--- a/src/parser/timetype.rs
+++ b/src/parser/timetype.rs
@@ -4,11 +4,11 @@ use std::str::FromStr;
use nom::digit;
use nom::whitespace::sp;
use chrono::NaiveDate;
-use failure::Fallible as Result;
use timetype::IntoTimeType;
use timetype;
-use error::ErrorKind as KEK;
+use error::Result;
+use error::Error;
named!(pub integer<i64>, alt!(
map_res!(
@@ -192,12 +192,12 @@ impl IntoTimeType for ExactDate {
ExactDate::Iso8601Date(date) => {
match date {
::iso8601::Date::YMD { year, month, day } => NaiveDate::from_ymd_opt(year, month, day)
- .ok_or(KEK::OutOfBounds(year, month, day, 0, 0, 0).into())
+ .ok_or(Error::OutOfBounds(year, month, day, 0, 0, 0))
.map(|ndt| ndt.and_hms(0, 0, 0))
.map(timetype::TimeType::moment),
::iso8601::Date::Week { year, ww, d } => NaiveDate::from_ymd_opt(year, 1, 1)
- .ok_or(KEK::OutOfBounds(year, 1, 1, 0, 0, 0).into())
+ .ok_or(Error::OutOfBounds(year, 1, 1, 0, 0, 0))
.map(|ndt| ndt.and_hms(0, 0, 0))
.map(timetype::TimeType::moment)
.map(|m| {
@@ -207,7 +207,7 @@ impl IntoTimeType for ExactDate {
}),
::iso8601::Date::Ordinal { year, ddd } => NaiveDate::from_ymd_opt(year, 1, 1)
- .ok_or(KEK::OutOfBounds(year, 1, 1, 0, 0, 0).into())
+ .ok_or(Error::OutOfBounds(year, 1, 1, 0, 0, 0))
.map(|ndt| ndt.and_hms(0, 0, 0))
.map(timetype::TimeType::moment)
.map(|m| m + timetype::TimeType::days(ddd as i64)),
@@ -219,11 +219,11 @@ impl IntoTimeType for ExactDate {
match date {
::iso8601::Date::YMD { year, month, day } => NaiveDate::from_ymd_opt(year, month, day)
.and_then(|ndt| ndt.and_hms_opt(hour, minute, second))
- .ok_or(KEK::OutOfBounds(year, month, day, hour, minute, second).into())
+ .ok_or(Error::OutOfBounds(year, month, day, hour, minute, second))
.map(timetype::TimeType::moment),
::iso8601::Date::Week { year, ww, d } => NaiveDate::from_ymd_opt(year, 1, 1)
- .ok_or(KEK::OutOfBounds(year, 1, 1, 0, 0, 0).into())
+ .ok_or(Error::OutOfBounds(year, 1, 1, 0, 0, 0))
.map(|ndt| ndt.and_hms(0, 0, 0))
.map(timetype::TimeType::moment)
.map(|m| {
@@ -236,7 +236,7 @@ impl IntoTimeType for ExactDate {
}),
::iso8601::Date::Ordinal { year, ddd } => NaiveDate::from_ymd_opt(year, 1, 1)
- .ok_or(KEK::OutOfBounds(year, 1, 1, 0, 0, 0).into())
+ .ok_or(Error::OutOfBounds(year, 1, 1, 0, 0, 0))
.map(|ndt| ndt.and_hms(0, 0, 0))
.map(timetype::TimeType::moment)
.map(|m| {