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

method Sender.clone

Another sender of the same channel; the channel closes when all senders are gone.

Example:

oxl✓ проверяется в CI
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()!}")
}
Вывод
1 2
pub(api) fn clone() -> Sender<T>

С версии. 1.0.0-beta

Возвращает

Sender<T>

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/task.oxl:100

См. также