claw 0.1.0-alpha2

Low-level information retrieval library.
Documentation
use std::fmt::Formatter;
use std::fmt::Error as StdError;

/// All functions in claw throw this error type in their results.
pub enum Error {
    NoneError,
    OutOfBounds,
    ExternalError(String)
}

impl std::error::Error for Error {}
impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), StdError> {
        write!(f, "{}", self.to_string())
    }
}

impl std::fmt::Debug for Error {
    fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), StdError> {
        (self as &dyn std::fmt::Display).fmt(f)
    }
}

impl std::convert::From<regex::Error> for Error {
    fn from(e : regex::Error) -> Self {
        Error::ExternalError(e.to_string())
    }
}

impl std::convert::From<std::io::Error> for Error {
    fn from(e : std::io::Error) -> Self {
        Error::ExternalError(e.to_string())
    }
}