diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..0e49d17 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,29 @@ +#![feature(plugin)] +#![plugin(regex_macros)] +extern crate regex; +extern crate chrono; + +pub mod log; +pub mod format; + +use std::error::FromError; +use std::{ io, result }; + +use chrono::format::ParseError; + +pub type Result<T> = result::Result<T, IlcError>; + +#[derive(Debug, PartialEq)] +pub enum IlcError { + Parse(String), + Chrono(ParseError), + Io(io::Error) +} + +impl FromError<ParseError> for IlcError { + fn from_error(err: ParseError) -> IlcError { IlcError::Chrono(err) } +} + +impl FromError<io::Error> for IlcError { + fn from_error(err: io::Error) -> IlcError { IlcError::Io(err) } +} |