Skip to main content

DispatchEffect

Trait DispatchEffect 

Source
pub trait DispatchEffect<U = ()> {
    // Required method
    fn dispatch(
        &mut self,
        tag: u64,
        request: &Value,
        cx: &EffectContext<'_, U>,
    ) -> Result<Value, EffectError>;
}
Expand description

Tag-based effect dispatch over an HList of handlers.

The JIT yields (tag, request) pairs where tag identifies which effect in the Eff '[E0, E1, ...] list fired. DispatchEffect peels one layer per HCons: tag 0 → head handler, tag N → tail with tag N−1.

You don’t implement this manually — it’s derived for frunk::HList![H0, H1, ...] when each Hi: EffectHandler.

Required Methods§

Source

fn dispatch( &mut self, tag: u64, request: &Value, cx: &EffectContext<'_, U>, ) -> Result<Value, EffectError>

Implementations on Foreign Types§

Source§

impl<U> DispatchEffect<U> for HNil

Source§

fn dispatch( &mut self, tag: u64, _request: &Value, _cx: &EffectContext<'_, U>, ) -> Result<Value, EffectError>

Source§

impl<U, H: EffectHandler<U>, T: DispatchEffect<U>> DispatchEffect<U> for HCons<H, T>

Source§

fn dispatch( &mut self, tag: u64, request: &Value, cx: &EffectContext<'_, U>, ) -> Result<Value, EffectError>

Implementors§