mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
chore: use ready macro from futures-core (#1300)
This commit is contained in:
committed by
Carl Lerche
parent
ca708d6d87
commit
83273b8b50
@@ -1,19 +1,6 @@
|
||||
#![deny(warnings, rust_2018_idioms)]
|
||||
#![feature(async_await)]
|
||||
|
||||
/// Unwrap a ready value or propagate `Async::Pending`.
|
||||
#[macro_export]
|
||||
macro_rules! ready {
|
||||
($e:expr) => {{
|
||||
use std::task::Poll::{Pending, Ready};
|
||||
|
||||
match $e {
|
||||
Ready(v) => v,
|
||||
Pending => return Pending,
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
#[path = "../src/oneshot.rs"]
|
||||
#[allow(warnings)]
|
||||
mod oneshot;
|
||||
|
||||
@@ -10,6 +10,7 @@ mod semaphore;
|
||||
use crate::semaphore::*;
|
||||
|
||||
use async_util::future::poll_fn;
|
||||
use futures_core::ready;
|
||||
use loom::futures::block_on;
|
||||
use loom::thread;
|
||||
use std::future::Future;
|
||||
@@ -20,19 +21,6 @@ use std::sync::Arc;
|
||||
use std::task::Poll::Ready;
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
/// Unwrap a ready value or propagate `Poll::Pending`.
|
||||
#[macro_export]
|
||||
macro_rules! ready {
|
||||
($e:expr) => {{
|
||||
use std::task::Poll::{Pending, Ready};
|
||||
|
||||
match $e {
|
||||
Ready(v) => v,
|
||||
Pending => return Pending,
|
||||
}
|
||||
}};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn basic_usage() {
|
||||
const NUM: usize = 2;
|
||||
|
||||
Reference in New Issue
Block a user