Skip to main content

EffectSink

Trait EffectSink 

Source
pub trait EffectSink<M, I> {
    // Required method
    fn emit(&mut self, effect: Effect<M, I>);
}
Expand description

Receives the effects a protocol emits.

The core deliberately has no opinion about how effects are stored. A driver that wants amortised allocation passes a Vec and reuses it across events; a no_std or latency-sensitive driver passes a fixed-capacity sink; a test passes one that merely counts. Protocol code is identical in every case, because a protocol only ever calls Cx::send and friends.

Required Methods§

Source

fn emit(&mut self, effect: Effect<M, I>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<M, I> EffectSink<M, I> for Vec<Effect<M, I>>

Source§

fn emit(&mut self, effect: Effect<M, I>)

Implementors§