Skip to main content

Module dispatch

Module dispatch 

Source
Expand description

Five-mode typed-event dispatch (DESIGN §6.1; mode semantics follow Cordis).

Like Cordis, the mode is a property of the dispatch call:

  • Ctx::emit — observe: run Ctx::on observers in registration order, no results. (Cordis emit does not await; this crate has no executor, so observers run to completion instead of being spawned — documented deviation.)
  • Ctx::parallel — the same observers, awaited concurrently.
  • Ctx::serial — Ctx::on_serial handlers awaited in registration order; returns every handler’s value in order.
  • Ctx::waterfall — a WaterfallMiddleware chain over a value; any middleware may short-circuit with Flow::Stop (design intent for single-decision events).
  • Ctx::bail — Ctx::on_bail handlers until the first Some (“bail”) value is returned.

Every registration (on, on_serial, on_waterfall, on_bail) returns a Disposer removing exactly that handler — registrations are reversible side effects.

Structs§

WaterfallNext
The next() handle passed to waterfall middleware: invoking next(value) runs the rest of the chain (whose result is a Flow — an inner short-circuit propagates outward). Consumed by WaterfallMiddleware implementations.

Enums§

Flow
The result of one waterfall middleware step: continue into the rest of the chain, or short-circuit the whole waterfall (both carry the value).

Traits§

WaterfallMiddleware
One step of a waterfall chain over event E and value T.

Type Aliases§

BailHandler
Bail handler for event E producing an optional bail value T.
Observer
Observer for event E: invoked by both emit and parallel.
SerialHandler
Serial handler for event E producing a value R.