use super::super::traits::*;
use {kutil::std::error::*, std::marker::*};
#[derive(Debug)]
pub struct IntoAnnotatedErrorReceiver<'own, InnerT, ErrorT> {
pub inner: &'own mut InnerT,
error: PhantomData<ErrorT>,
}
impl<'own, InnerT, ErrorT, NewErrorT> ErrorReceiver<NewErrorT> for IntoAnnotatedErrorReceiver<'own, InnerT, ErrorT>
where
InnerT: ErrorReceiver<ErrorT>,
ErrorT: IntoAnnotated<NewErrorT>,
NewErrorT: IntoAnnotated<ErrorT>,
{
fn give_error(&mut self, error: NewErrorT) -> Result<(), NewErrorT> {
self.inner.give_error(error.into_annotated()).map_err(|error| error.into_annotated())
}
}
impl<'own, InnerT, ErrorT> IntoAnnotated<IntoAnnotatedErrorReceiver<'own, InnerT, ErrorT>> for &'own mut InnerT {
fn into_annotated(self) -> IntoAnnotatedErrorReceiver<'own, InnerT, ErrorT> {
IntoAnnotatedErrorReceiver { inner: self, error: PhantomData }
}
}