Skip to main content

Module dispatcher

Module dispatcher 

Source
Expand description

Zero-cost1 type-safe event dispatchers handling events mostly at compile time(event matching logic should reduce to a jump table used in a loop, the implementation doesn’t use runtime maps or virtual calls giving the compiler full information required to do optimizations). See DispatchChain for a quick start


  1. Sequential dispatchers erase types with Box<dyn Future> making them non-zerocost, this will be fixed after async_fn_traits stabilization, today’s Rust lacks expressive power to bind Future lifetimes correctly. For sequential scenarios reading events as a stream can produce more efficient assembly 

Structs§

DispatchChain
Dispatcher builder. Obtained from EventStream::into_dispatcher.
Dispatcher
Builds a compile-time dispatch chain in its type parameter D. The chain is unrolled in Self::sequential_dispatch or Self::dispatch.
Fallback
Intercept
Match

Traits§

ConcurrentDispatchEvent
DispatchEvent