OxL Reference

init Broadcast.new

buffer unread elements per subscriber (at least 1); a new subscriber first receives up to replay of the most recent elements (at most buffer).

Example:

oxl✓ checked in CI
use std.stream { Broadcast }

fn main() io {
  let hub = Broadcast<i32>.new(buffer: 8, replay: 2)
  print("{hub.subscribers()}")
}
Output
0
pub(api) init new(buffer: usize, slow: SlowPolicy = .Block, replay: usize = 0) -> Self

Complexity. O(1).

Since. 1.0.0-beta

Parameters

NameType
bufferusize
slowSlowPolicy = .Block
replayusize = 0

Returns

Self

Effects

none declared (pure unless the body says otherwise)

Defined in: std/stream/stream.oxl:581

See also