use core::fmt;
use super::Result;
#[derive(Debug)]
pub enum Error {
Unsupported(&'static str),
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&Error::Unsupported(ref msg) => write!(f, "{}", msg),
}
}
}
impl std::error::Error for Error {
fn cause(&self) -> Option<&dyn std::error::Error> {
match *self {
Error::Unsupported(_) => None,
}
}
}
pub fn unsupported_error<T>(msg: &'static str) -> Result<T> {
Err(Error::Unsupported(msg))
}