The Std.Sync.Broadcast module implements a broadcasting primitive for sending values
to multiple consumers. It maintains a queue of values and supports both synchronous
and asynchronous waiting.
This module is heavily inspired by Std.Sync.Channel as well as
tokio’s broadcast implementation.
Errors that may be thrown while interacting with the broadcast channel API.
- closed : Error
Tried to send to a closed broadcast channel.
- alreadyClosed : Error
Tried to close an already closed broadcast channel.
- notSubscribed : Error
Tried to unsubscribe a channel that already is not part of it.
Instances For
A multi-subscriber broadcast that delivers each message to all current subscribers.
Supports only bounded buffering and an asynchronous API; to switch into
synchronous mode use Broadcast.sync.
Unlike Std.Channel, each message is received by every subscriber instead of just one.
Subscribers only receive messages sent after they have subscribed (unless otherwise specified).
- inner : Std.Bounded✝ α
Instances For
A receiver for a Broadcast channel that can asynchronously receive messages.
Each receiver gets a copy of every message sent to the broadcast channel after
the receiver was created. Multiple receivers can exist for the same broadcast,
and each will receive all messages independently.
- inner : Std.Bounded.Receiver✝ α
Instances For
Creates a Selector that resolves once the broadcast channel ch has data available and provides that data.
Equations
Instances For
ch.forAsync f calls f for every message received on ch.
Note that if this function is called twice, each message will only arrive at exactly one invocation.
Equations
Instances For
Equations
Equations
Equations
A multi-subscriber broadcast that delivers each message to all current subscribers. Supports only bounded buffering and an asynchronous API.
It's the sync version of Broadcast.
Equations
Instances For
A receiver for a Broadcast channel that can asynchronously receive messages.
Each receiver gets a copy of every message sent to the broadcast channel after
the receiver was created. Multiple receivers can exist for the same broadcast,
and each will receive all messages independently.
It's the sync version of Broadcast.Receiver.