1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#[cfg(not(feature = "std"))]
use core::fmt::{Debug, Display};

#[cfg(feature = "std")]
pub trait Error: std::error::Error + Send + Sync + 'static {}

#[cfg(not(feature = "std"))]
pub trait Error: Debug + Display + Send + Sync + 'static {}

#[cfg(not(feature = "std"))]
impl<E> Error for E where E: Debug + Display + Send + Sync + 'static {}

#[cfg(feature = "std")]
impl<E> Error for E where E: std::error::Error + Send + Sync + 'static {}

pub trait Errors {
    type Error: Error;
}

impl<'a, S> Errors for &'a S
where
    S: Errors,
{
    type Error = S::Error;
}

impl<'a, S> Errors for &'a mut S
where
    S: Errors,
{
    type Error = S::Error;
}