method Sender.clone
Another sender of the same channel; the channel closes when all senders are gone.
Example:
fn main() io {
let (tx, rx) = chan<i64>(cap: 2)
let tx2 = tx.clone()
tx.send(1)!
tx2.send(2)!
print("{rx.recv()!} {rx.recv()!}")
}Output
1 2
pub(api) fn clone() -> Sender<T>Since. 1.0.0-beta
Returns
Sender<T>
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/task.oxl:100