pub struct Yielder<'a, Effs>where
Effs: MapResume,{ /* private fields */ }Expand description
Handle passed to computation closures for yielding effects.
Use yield_ to perform an effect and receive the handler’s
resume value.
Implementations§
Source§impl<'a, Effs> Yielder<'a, Effs>where
Effs: MapResume,
impl<'a, Effs> Yielder<'a, Effs>where
Effs: MapResume,
Sourcepub async fn yield_<E, Index>(&self, effect: E) -> E::Resume<'a>where
E: Effect,
Effs: CoprodInjector<E, Index>,
<Effs as MapResume>::Output<'a>: CoprodUninjector<E::Resume<'a>, Index>,
pub async fn yield_<E, Index>(&self, effect: E) -> E::Resume<'a>where
E: Effect,
Effs: CoprodInjector<E, Index>,
<Effs as MapResume>::Output<'a>: CoprodUninjector<E::Resume<'a>, Index>,
Yield an effect to the handler and suspend until resumed.
Returns the resume value provided by the handler for this effect.
Sourcepub async fn invoke<SubEffs, R, L, Indices>(
&self,
program: Eff<'a, SubEffs, R, L>,
) -> Rwhere
SubEffs: Effects<'a> + ForwardEffects<'a, Effs, Indices>,
L: Locality,
pub async fn invoke<SubEffs, R, L, Indices>(
&self,
program: Eff<'a, SubEffs, R, L>,
) -> Rwhere
SubEffs: Effects<'a> + ForwardEffects<'a, Effs, Indices>,
L: Locality,
Invoke a sub-program, forwarding its effects through this yielder.
The sub-program’s effects must be a subset of this yielder’s effects. Each effect yielded by the sub-program is forwarded to the outer handler via this yielder, and the resume value is passed back to the sub-program.
Returns the sub-program’s result directly. If the outer handler cancels,
the entire coroutine is dropped, so invoke never returns in that case.
Auto Trait Implementations§
impl<'a, Effs> Freeze for Yielder<'a, Effs>
impl<'a, Effs> RefUnwindSafe for Yielder<'a, Effs>where
Effs: RefUnwindSafe,
<Effs as MapResume>::Output<'a>: RefUnwindSafe,
impl<'a, Effs> Send for Yielder<'a, Effs>
impl<'a, Effs> Sync for Yielder<'a, Effs>
impl<'a, Effs> Unpin for Yielder<'a, Effs>
impl<'a, Effs> UnsafeUnpin for Yielder<'a, Effs>
impl<'a, Effs> UnwindSafe for Yielder<'a, Effs>where
Effs: UnwindSafe,
<Effs as MapResume>::Output<'a>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more