use std::error::Error as StdError;
use std::fmt::Display;
use std::result;
pub type Result<T> = result::Result<T, Error>;
#[derive(Debug)]
pub struct Error(Box<dyn StdError + Send + Sync + 'static>);
impl AsRef<dyn StdError + Send + Sync> for Error {
fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) {
self.0.as_ref()
}
}
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Display::fmt(&self.0, f)
}
}
#[doc(hidden)]
impl<T> From<T> for Error
where
T: Into<Box<dyn StdError + Send + Sync + 'static>>,
{
fn from(err: T) -> Self {
Self(err.into())
}
}