sync: add async APIs to oneshot and mpsc (#1211)

Adds:

- oneshot::Sender::close
- mpsc::Receiver::recv
- mpsc::Sender::send

Also renames `poll_next` to `poll_recv`.

Refs: #1210
This commit is contained in:
Carl Lerche
2019-06-27 11:33:36 -07:00
committed by GitHub
parent 0af05e7408
commit 32ceccb465
10 changed files with 143 additions and 41 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
#![deny(warnings, rust_2018_idioms)]
#![feature(async_await)]
#[macro_use]
extern crate loom;
@@ -32,10 +33,10 @@ fn closing_tx() {
drop(tx);
});
let v = block_on(poll_fn(|cx| rx.poll_next(cx)));
let v = block_on(poll_fn(|cx| rx.poll_recv(cx)));
assert!(v.is_some());
let v = block_on(poll_fn(|cx| rx.poll_next(cx)));
let v = block_on(poll_fn(|cx| rx.poll_recv(cx)));
assert!(v.is_none());
});
}