use core::fmt::{Debug, Display, Formatter};
use core::pin::Pin;
pub struct SelfieError<P, E> {
pub owned: Pin<P>,
pub error: E,
}
impl<P, E: Debug> Debug for SelfieError<P, E> {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
self.error.fmt(f)
}
}
impl<P, E: Display> Display for SelfieError<P, E> {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
self.error.fmt(f)
}
}
#[cfg(feature = "std")]
mod std_impl {
extern crate std;
use crate::SelfieError;
use std::error::Error;
impl<P, E: Error + 'static> Error for SelfieError<P, E> {
#[inline]
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(&self.error)
}
}
}