use std::marker::PhantomData;
#[derive(Debug, Clone, Copy)]
pub struct ErrInspectStep<ErrType, InspectorFn>
where
InspectorFn: Fn(&ErrType),
{
inspector: InspectorFn,
_phantom: PhantomData<ErrType>,
}
impl<ErrType, InspectorFn> ErrInspectStep<ErrType, InspectorFn>
where
InspectorFn: Fn(&ErrType),
{
pub const fn new(inspector: InspectorFn) -> Self {
Self {
inspector,
_phantom: PhantomData,
}
}
pub(crate) fn apply(&self, input_err: ErrType) -> ErrType {
(self.inspector)(&input_err);
input_err
}
}