method Broadcast.close
Ends every subscription (after the elements it still has). Idempotent; the handle stays usable for
subscribers() (II.2 writes move fn close(); a borrow accepts every program that a move accepts, D-2614).
Example:
use std.stream { Broadcast }
fn main() io, time {
let hub = Broadcast<i32>.new(buffer: 4)
var sub = hub.subscribe()
hub.publish(1)
hub.close()
var n = 0
while true {
match sub.pullWithin(1s) {
Pulled.Item(_) => n += 1
_ => break
}
}
print("{n}")
}Output
1
pub(api) fn close()Since. 1.0.0-beta
Effects
none declared (pure unless the body says otherwise)
Defined in: std/stream/stream.oxl:681