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}")
}Вывод
1
pub(api) fn close()С версии. 1.0.0-beta
Эффекты
не объявлены (чистая, пока тело не говорит иное)
Определено в: std/stream/stream.oxl:681