You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
606 B

use std::fmt::{Display, Formatter, Result as FmtResult};
use log::SetLoggerError;
pub type RagResult<T> = Result<T, RagError>;
#[derive(Debug)]
pub enum RagError {
SetLogger(SetLoggerError),
Empty,
}
impl From<()> for RagError {
fn from(_: ()) -> RagError {
RagError::Empty
}
}
impl From<SetLoggerError> for RagError {
fn from(e: SetLoggerError) -> RagError {
RagError::SetLogger(e)
}
}
impl Display for RagError {
fn fmt(&self, f: &mut Formatter) -> FmtResult {
match *self {
RagError::SetLogger(ref e) => Display::fmt(e, f),
RagError::Empty => Display::fmt("Empty", f),
}
}
}