use std::error::Error;
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::io;
use std::sync::Arc;
#[must_use = "the shared tee error must be reported or retained"]
#[derive(Debug)]
pub(super) struct SharedTeeError {
original: Arc<io::Error>,
}
impl SharedTeeError {
#[inline]
pub(super) fn new(original: Arc<io::Error>) -> Self {
Self { original }
}
}
impl Display for SharedTeeError {
fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult {
Display::fmt(self.original.as_ref(), formatter)
}
}
impl Error for SharedTeeError {
#[inline]
fn source(&self) -> Option<&(dyn Error + 'static)> {
Some(self.original.as_ref())
}
}