Skip to main content

Crate polarway_bus

Crate polarway_bus 

Source
Expand description

§Polarway Bus — Generic Event Fan-Out

A domain-agnostic event bus with:

  • Broadcast fan-out: every subscriber gets every event (unless filtered).
  • Per-subscriber drain buffers: subscribers can drain all pending events in one batch call (no async required).
  • Filter predicates: subscribers can register a filter closure to ignore irrelevant events.
  • Back-pressure policy: configurable behavior when a subscriber falls behind.

§Design Principles

  • Generic over event type T: Clone + Send + Sync + 'static
  • No finance-specific code — usable for signals, logs, metrics, or any domain
  • Railway-oriented: methods return Result where appropriate
  • Efficient: uses tokio::sync::broadcast for the hot path

Structs§

EventBus
A generic, domain-agnostic event bus.
FilteredSubscriber
A filtered subscriber that only buffers events passing a predicate.
Subscriber
An unfiltered subscriber that accumulates events for sync drain.

Enums§

BusError
Errors that can occur during bus operations.

Type Aliases§

BusResult
Result type for bus operations.