use crate::raw;
use std::error;
use std::fmt;
use std::io;
pub type Result<T> = ::std::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {
Fst(raw::Error),
Io(io::Error),
}
impl From<io::Error> for Error {
#[inline]
fn from(err: io::Error) -> Error {
Error::Io(err)
}
}
impl From<raw::Error> for Error {
#[inline]
fn from(err: raw::Error) -> Error {
Error::Fst(err)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::Error::*;
match *self {
Fst(ref err) => err.fmt(f),
Io(ref err) => err.fmt(f),
}
}
}
impl error::Error for Error {
fn cause(&self) -> Option<&dyn error::Error> {
use self::Error::*;
match *self {
Fst(ref err) => Some(err),
Io(ref err) => Some(err),
}
}
}