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 #[must_use]
20 pub fn into_inner(self) -> BoxError {
21 self.inner
22 }
23}
24
25impl fmt::Display for Error {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 self.inner.fmt(f)
28 }
29}
30
31impl StdError for Error {
32 fn source(&self) -> Option<&(dyn StdError + 'static)> {
33 Some(&*self.inner)
34 }
35}