data Sender
Channel endpoints (§8.7).
Example:
fn main() io {
let (tx, rx) = chan<i64>(cap: 2)
tx.send(1)!
tx.send(2)!
print("{rx.recv()!} {rx.recv()!}")
}Output
1 2
@builtin("Sender") pub(api) data Sender<T>Thread safety. `clone()` it to give every producer task its own sender.
Since. 1.0.0-beta
Methods
send | (x: T) -> () | ClosedSends a value, waiting while the buffer is full; Closed if the receiver is gone. |
clone | () -> Sender<T>Another sender of the same channel; the channel closes when all senders are gone. |
Defined in: std/core/types.oxl:476