OxL Справочник OxL
РусскийEnglish

enum SlowPolicy

What publish does when a subscriber has buffer unread elements.

Example:

oxl✓ проверяется в CI
use std.stream { Broadcast, SlowPolicy }

fn main() io {
  let hub = Broadcast<i32>.new(buffer: 2, slow: SlowPolicy.DropOldest)
  print("{hub.subscribers()}")
}
Вывод
0
pub(api) enum SlowPolicy

С версии. 1.0.0-beta

Варианты

Block

publish waits until the slowest subscriber has room.

DropOldest

The subscriber's oldest unread elements are dropped; sub.lagged() counts them.

Disconnect

The subscription ends with the error Lagged after the elements it already has.

Определено в: std/stream/stream.oxl:527

См. также