1
2
3
4
5
6
7
8
9
10
11
12
13
14
use super::{controlflow::ControlFlowInstance, *};

/// Represents wrapped results which are instantly available.
pub trait LocalFunctor<'a>: WeakFunctor<'a> {
    /// Extract iteration state, if successful.
    fn unstuff<A: 'a + Send, B: 'a + Send>(
        state: Self::F<ControlFlow<B, A>>,
    ) -> ControlFlow<Self::F<B>, A> {
        Self::stuff::<_, ControlFlowInstance<_>>(state)
    }

    /// Stuff wrapped result into another functor.
    fn stuff<A: 'a + Send, T: Pure<'a>>(fa: Self::F<T::F<A>>) -> T::F<Self::F<A>>;
}