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