1use crate::BoxError;
2use std::{error::Error as StdError, fmt};
3
4#[derive(Debug)]
6pub struct Error {
7 inner: BoxError,
8}
9
10impl Error {
11 pub fn new(error: impl Into<BoxError>) -> Self {
13 Self {
14 inner: error.into(),
15 }
16 }
17
18 pub fn into_inner(self) -> BoxError {
20 self.inner
21 }
22}
23
24impl fmt::Display for Error {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 self.inner.fmt(f)
27 }
28}
29
30impl StdError for Error {
31 fn source(&self) -> Option<&(dyn StdError + 'static)> {
32 Some(&*self.inner)
33 }
34}