mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
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:
@@ -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());
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user