mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
chore: replace ready! with std::task::ready! (#6804)
This commit is contained in:
@@ -10,6 +10,7 @@ use futures::future::{self, FutureExt};
|
||||
use std::env;
|
||||
use std::io;
|
||||
use std::process::{ExitStatus, Stdio};
|
||||
use std::task::ready;
|
||||
|
||||
fn cat() -> Command {
|
||||
let mut cmd = Command::new(env!("CARGO_BIN_EXE_test-cat"));
|
||||
@@ -211,7 +212,7 @@ async fn vectored_writes() {
|
||||
if vectored == 0 {
|
||||
return std::task::Poll::Ready(std::io::Result::Ok(()));
|
||||
}
|
||||
let n = futures::ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?;
|
||||
let n = ready!(Pin::new(&mut stdin).poll_write_vectored(cx, &slices))?;
|
||||
writes_completed += 1;
|
||||
input.advance(n);
|
||||
})
|
||||
|
||||
@@ -57,12 +57,3 @@ macro_rules! cfg_signal {
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! ready {
|
||||
($e:expr $(,)?) => {
|
||||
match $e {
|
||||
std::task::Poll::Ready(t) => t,
|
||||
std::task::Poll::Pending => return std::task::Poll::Pending,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::Stream;
|
||||
use core::future::Future;
|
||||
use core::marker::PhantomPinned;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
@@ -42,7 +42,7 @@ where
|
||||
|
||||
// Take a maximum of 32 items from the stream before yielding.
|
||||
for _ in 0..32 {
|
||||
match futures_core::ready!(stream.as_mut().poll_next(cx)) {
|
||||
match ready!(stream.as_mut().poll_next(cx)) {
|
||||
Some(v) => {
|
||||
if !(me.f)(v) {
|
||||
return Poll::Ready(false);
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::Stream;
|
||||
use core::future::Future;
|
||||
use core::marker::PhantomPinned;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
@@ -42,7 +42,7 @@ where
|
||||
|
||||
// Take a maximum of 32 items from the stream before yielding.
|
||||
for _ in 0..32 {
|
||||
match futures_core::ready!(stream.as_mut().poll_next(cx)) {
|
||||
match ready!(stream.as_mut().poll_next(cx)) {
|
||||
Some(v) => {
|
||||
if (me.f)(v) {
|
||||
return Poll::Ready(true);
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::stream_ext::Fuse;
|
||||
use crate::Stream;
|
||||
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -4,7 +4,7 @@ use tokio::time::{sleep, Sleep};
|
||||
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use core::future::Future;
|
||||
use core::marker::PhantomPinned;
|
||||
use core::mem;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
// Do not export this struct until `FromStream` can be unsealed.
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::Stream;
|
||||
|
||||
use core::fmt;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::Stream;
|
||||
|
||||
use core::fmt;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::Stream;
|
||||
use core::future::Future;
|
||||
use core::marker::PhantomPinned;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::Stream;
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Stream returned by [`fuse()`][super::StreamExt::fuse].
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::Stream;
|
||||
|
||||
use core::fmt;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::Stream;
|
||||
|
||||
use core::fmt;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -5,7 +5,7 @@ use tokio::time::{Duration, Instant, Sleep};
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::task::{self, Poll};
|
||||
use std::task::{self, ready, Poll};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use tokio::time::{Instant, Sleep};
|
||||
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
use std::fmt;
|
||||
use std::time::Duration;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{Elapsed, Stream};
|
||||
use tokio::time::Interval;
|
||||
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
use core::task::{ready, Context, Poll};
|
||||
use pin_project_lite::pin_project;
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::{poll_fn, Stream};
|
||||
use std::borrow::Borrow;
|
||||
use std::hash::Hash;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Combine many streams into one, indexing each source stream with a unique
|
||||
/// key.
|
||||
|
||||
@@ -6,7 +6,7 @@ use futures_core::Stream;
|
||||
use tokio_util::sync::ReusableBoxFuture;
|
||||
|
||||
use std::fmt;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// A wrapper around [`tokio::sync::broadcast::Receiver`] that implements [`Stream`].
|
||||
///
|
||||
|
||||
@@ -5,7 +5,7 @@ use futures_core::Stream;
|
||||
use tokio_util::sync::ReusableBoxFuture;
|
||||
|
||||
use std::fmt;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use tokio::sync::watch::error::RecvError;
|
||||
|
||||
/// A wrapper around [`tokio::sync::watch::Receiver`] that implements [`Stream`].
|
||||
|
||||
@@ -23,13 +23,13 @@ use tokio::sync::mpsc;
|
||||
use tokio::time::{self, Duration, Instant, Sleep};
|
||||
use tokio_stream::wrappers::UnboundedReceiverStream;
|
||||
|
||||
use futures_core::{ready, Stream};
|
||||
use futures_core::Stream;
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::{self, Poll, Waker};
|
||||
use std::task::{self, ready, Poll, Waker};
|
||||
use std::{cmp, io};
|
||||
|
||||
/// An I/O object that follows a predefined script.
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::pin::Pin;
|
||||
use std::task::Poll;
|
||||
use std::task::{ready, Poll};
|
||||
use std::time::Duration;
|
||||
|
||||
use futures_core::{ready, Stream};
|
||||
use futures_core::Stream;
|
||||
use std::future::Future;
|
||||
use tokio::time::{sleep_until, Instant, Sleep};
|
||||
|
||||
|
||||
@@ -5,13 +5,12 @@ use futures_core::Stream;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures_core::ready;
|
||||
use futures_sink::Sink;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::borrow::{Borrow, BorrowMut};
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
//! Compatibility between the `tokio::io` and `futures-io` versions of the
|
||||
//! `AsyncRead` and `AsyncWrite` traits.
|
||||
use futures_core::ready;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// A compatibility layer that allows conversion between the
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use futures_core::ready;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::io::{IoSlice, Result};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use futures_core::ready;
|
||||
use futures_sink::Sink;
|
||||
|
||||
use futures_core::stream::Stream;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use futures_core::{ready, Stream};
|
||||
use futures_core::Stream;
|
||||
use std::fmt;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use tokio::sync::{AcquireError, OwnedSemaphorePermit, Semaphore, TryAcquireError};
|
||||
|
||||
use super::ReusableBoxFuture;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
use crate::time::wheel::{self, Wheel};
|
||||
|
||||
use futures_core::ready;
|
||||
use tokio::time::{sleep_until, Duration, Instant, Sleep};
|
||||
|
||||
use core::ops::{Index, IndexMut};
|
||||
@@ -19,7 +18,7 @@ use std::fmt::Debug;
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::pin::Pin;
|
||||
use std::task::{self, Poll, Waker};
|
||||
use std::task::{self, ready, Poll, Waker};
|
||||
|
||||
/// A queue of delayed elements.
|
||||
///
|
||||
@@ -74,9 +73,8 @@ use std::task::{self, Poll, Waker};
|
||||
/// ```rust,no_run
|
||||
/// use tokio_util::time::{DelayQueue, delay_queue};
|
||||
///
|
||||
/// use futures::ready;
|
||||
/// use std::collections::HashMap;
|
||||
/// use std::task::{Context, Poll};
|
||||
/// use std::task::{ready, Context, Poll};
|
||||
/// use std::time::Duration;
|
||||
/// # type CacheKey = String;
|
||||
/// # type Value = String;
|
||||
|
||||
@@ -4,10 +4,9 @@ use futures_core::Stream;
|
||||
use tokio::{io::ReadBuf, net::UdpSocket};
|
||||
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use futures_core::ready;
|
||||
use futures_sink::Sink;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
|
||||
use bytes::{Buf, BufMut};
|
||||
use futures_core::ready;
|
||||
use std::io::{self, IoSlice};
|
||||
use std::mem::MaybeUninit;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Try to read data from an `AsyncRead` into an implementer of the [`BufMut`] trait.
|
||||
///
|
||||
|
||||
@@ -14,8 +14,7 @@ use std::io::{self, Seek, SeekFrom};
|
||||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
#[cfg(test)]
|
||||
use super::mocks::JoinHandle;
|
||||
|
||||
@@ -8,8 +8,7 @@ use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
#[cfg(test)]
|
||||
use super::mocks::spawn_blocking;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use pin_project_lite::pin_project;
|
||||
use std::future::{Future, IntoFuture};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// A future that may have completed.
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
use std::{task::Context, task::Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Associates an IO object backed by a Unix file descriptor with the tokio
|
||||
/// reactor, allowing for readiness to be polled. The file descriptor must be of
|
||||
@@ -71,11 +71,10 @@ use std::{task::Context, task::Poll};
|
||||
/// and using the IO traits [`AsyncRead`] and [`AsyncWrite`].
|
||||
///
|
||||
/// ```no_run
|
||||
/// use futures::ready;
|
||||
/// use std::io::{self, Read, Write};
|
||||
/// use std::net::TcpStream;
|
||||
/// use std::pin::Pin;
|
||||
/// use std::task::{Context, Poll};
|
||||
/// use std::task::{ready, Context, Poll};
|
||||
/// use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
/// use tokio::io::unix::AsyncFd;
|
||||
///
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::future::Future;
|
||||
use std::io;
|
||||
use std::io::prelude::*;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// `T` should not implement _both_ Read and Write.
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::io;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::os::unix::prelude::RawFd;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Like [`mio::event::Source`], but for POSIX AIO only.
|
||||
///
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::fmt;
|
||||
use std::io;
|
||||
use std::ops::Deref;
|
||||
use std::panic::{RefUnwindSafe, UnwindSafe};
|
||||
use std::task::ready;
|
||||
|
||||
cfg_io_driver! {
|
||||
/// Associates an I/O resource that implements the [`std::io::Read`] and/or
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::future::Future;
|
||||
use std::io::{self, SeekFrom};
|
||||
use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Future for the [`seek`](crate::io::AsyncSeekExt::seek) method.
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::io::{AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite, ReadBuf};
|
||||
use pin_project_lite::pin_project;
|
||||
use std::io::{self, IoSlice, SeekFrom};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use std::{cmp, fmt, mem};
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -5,7 +5,7 @@ use pin_project_lite::pin_project;
|
||||
use std::fmt;
|
||||
use std::io::{self, IoSlice, SeekFrom, Write};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Wraps a writer and buffers its output.
|
||||
|
||||
@@ -4,7 +4,7 @@ use pin_project_lite::pin_project;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Stream for the [`chain`](super::AsyncReadExt::chain) method.
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) struct CopyBuffer {
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
enum TransferState {
|
||||
Running(CopyBuffer),
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::io::{AsyncBufRead, AsyncWrite};
|
||||
use std::future::Future;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
/// A future that asynchronously copies the entire contents of a reader into a
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::io::{AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite, ReadBuf};
|
||||
use std::fmt;
|
||||
use std::io::{self, SeekFrom};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
/// `Empty` ignores any data written via [`AsyncWrite`], and will always be empty
|
||||
|
||||
@@ -5,7 +5,7 @@ use pin_project_lite::pin_project;
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Reads lines from an [`AsyncBufRead`].
|
||||
|
||||
@@ -7,7 +7,7 @@ use bytes::{Buf, BytesMut};
|
||||
use std::{
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
task::{self, Poll, Waker},
|
||||
task::{self, ready, Poll, Waker},
|
||||
};
|
||||
|
||||
/// A bidirectional pipe to read and write bytes in memory.
|
||||
|
||||
@@ -88,7 +88,7 @@ cfg_io_util! {
|
||||
|
||||
cfg_coop! {
|
||||
fn poll_proceed_and_make_progress(cx: &mut std::task::Context<'_>) -> std::task::Poll<()> {
|
||||
let coop = ready!(crate::runtime::coop::poll_proceed(cx));
|
||||
let coop = std::task::ready!(crate::runtime::coop::poll_proceed(cx));
|
||||
coop.made_progress();
|
||||
std::task::Poll::Ready(())
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::marker::Unpin;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Tries to read some bytes directly into the given `buf` in asynchronous
|
||||
/// manner, returning a future type.
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::future::Future;
|
||||
use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B>
|
||||
where
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::marker::Unpin;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// A future which can be used to easily read exactly enough bytes to fill
|
||||
/// a buffer.
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::marker::PhantomPinned;
|
||||
use std::mem;
|
||||
use std::pin::Pin;
|
||||
use std::string::FromUtf8Error;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Future for the [`read_line`](crate::io::AsyncBufReadExt::read_line) method.
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::mem::{self, MaybeUninit};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -7,7 +7,7 @@ use pin_project_lite::pin_project;
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use std::{io, mem};
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::mem;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Future for the [`read_until`](crate::io::AsyncBufReadExt::read_until) method.
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::io::{AsyncRead, ReadBuf};
|
||||
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
/// An async reader which yields one byte over and over and over and over and
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::io::AsyncWrite;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
/// An async writer which will move data into the void.
|
||||
|
||||
@@ -5,7 +5,7 @@ use pin_project_lite::pin_project;
|
||||
use std::io;
|
||||
use std::mem;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// Splitter for the [`split`](crate::io::AsyncBufReadExt::split) method.
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::io::{AsyncBufRead, AsyncRead, ReadBuf};
|
||||
use pin_project_lite::pin_project;
|
||||
use std::convert::TryFrom;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
use std::{cmp, io};
|
||||
|
||||
pin_project! {
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::mem;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::future::Future;
|
||||
use std::io::{self, IoSlice};
|
||||
use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// A future to write some of the buffer to an `AsyncWrite`.
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::future::Future;
|
||||
use std::io;
|
||||
use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
pin_project! {
|
||||
/// A future to write some of the buffer to an `AsyncWrite`.
|
||||
|
||||
@@ -9,9 +9,6 @@ mod loom;
|
||||
#[macro_use]
|
||||
mod pin;
|
||||
|
||||
#[macro_use]
|
||||
mod ready;
|
||||
|
||||
#[macro_use]
|
||||
mod thread_local;
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
macro_rules! ready {
|
||||
($e:expr $(,)?) => {
|
||||
match $e {
|
||||
std::task::Poll::Ready(t) => t,
|
||||
std::task::Poll::Pending => return std::task::Poll::Pending,
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -274,7 +274,7 @@ pub(crate) mod sealed {
|
||||
|
||||
use std::option;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready,Context, Poll};
|
||||
use std::vec;
|
||||
|
||||
#[doc(hidden)]
|
||||
|
||||
@@ -8,7 +8,7 @@ cfg_not_wasi! {
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{self, SocketAddr};
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_net! {
|
||||
/// A TCP socket server, listening for connections.
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{Shutdown, SocketAddr};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
use bytes::BufMut;
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::net::{to_socket_addrs, ToSocketAddrs};
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr};
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
use bytes::BufMut;
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::net::Shutdown;
|
||||
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use std::os::unix::net;
|
||||
use std::path::Path;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_util! {
|
||||
use bytes::BufMut;
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
|
||||
use std::os::unix::net::{self, SocketAddr as StdSocketAddr};
|
||||
use std::path::Path;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_net_unix! {
|
||||
/// A Unix socket which can accept connections from other Unix sockets.
|
||||
|
||||
@@ -250,8 +250,7 @@ use std::io;
|
||||
use std::path::Path;
|
||||
use std::pin::Pin;
|
||||
use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
|
||||
use std::task::Context;
|
||||
use std::task::Poll;
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::process::CommandExt;
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::{
|
||||
pin::Pin,
|
||||
process::ExitStatus,
|
||||
sync::atomic::{AtomicBool, Ordering::Relaxed},
|
||||
task::{Context, Poll},
|
||||
task::{ready, Context, Poll},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -312,7 +312,7 @@ mod test {
|
||||
}
|
||||
|
||||
let mut task = task::spawn(poll_fn(|cx| {
|
||||
let coop = ready!(poll_proceed(cx));
|
||||
let coop = std::task::ready!(poll_proceed(cx));
|
||||
coop.made_progress();
|
||||
Poll::Ready(())
|
||||
}));
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::runtime::scheduler;
|
||||
use mio::event::Source;
|
||||
use std::io;
|
||||
use std::sync::Arc;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
cfg_io_driver! {
|
||||
/// Associates an I/O resource with the reactor instance that drives it.
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::panic::{RefUnwindSafe, UnwindSafe};
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll, Waker};
|
||||
use std::task::{ready, Context, Poll, Waker};
|
||||
|
||||
cfg_rt! {
|
||||
/// An owned permission to join on a task (await its termination).
|
||||
|
||||
@@ -21,7 +21,7 @@ use pin_project_lite::pin_project;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::atomic::Ordering::{Relaxed, SeqCst};
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
mod atomic_take {
|
||||
use loom::sync::atomic::AtomicBool;
|
||||
|
||||
@@ -23,7 +23,7 @@ use pin_project_lite::pin_project;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::atomic::Ordering::{Relaxed, SeqCst};
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
mod atomic_take {
|
||||
use loom::sync::atomic::AtomicBool;
|
||||
|
||||
@@ -28,7 +28,7 @@ use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::Ordering::*;
|
||||
use std::task::{Context, Poll, Waker};
|
||||
use std::task::{ready, Context, Poll, Waker};
|
||||
use std::{cmp, fmt};
|
||||
|
||||
/// An asynchronous counting semaphore which permits waiting on multiple permits at once.
|
||||
|
||||
@@ -128,7 +128,7 @@ use std::marker::PhantomPinned;
|
||||
use std::pin::Pin;
|
||||
use std::ptr::NonNull;
|
||||
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
|
||||
use std::task::{Context, Poll, Waker};
|
||||
use std::task::{ready, Context, Poll, Waker};
|
||||
|
||||
/// Sending-half of the [`broadcast`] channel.
|
||||
///
|
||||
|
||||
@@ -13,7 +13,7 @@ use std::panic;
|
||||
use std::process;
|
||||
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
|
||||
use std::task::Poll::{Pending, Ready};
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Channel sender.
|
||||
pub(crate) struct Tx<T, S> {
|
||||
|
||||
@@ -1041,7 +1041,7 @@ impl Notified<'_> {
|
||||
#[cfg(tokio_taskdump)]
|
||||
if let Some(waker) = waker {
|
||||
let mut ctx = Context::from_waker(waker);
|
||||
ready!(crate::trace::trace_leaf(&mut ctx));
|
||||
std::task::ready!(crate::trace::trace_leaf(&mut ctx));
|
||||
}
|
||||
|
||||
if waiter.notification.load(Acquire).is_some() {
|
||||
@@ -1135,7 +1135,7 @@ impl Notified<'_> {
|
||||
#[cfg(tokio_taskdump)]
|
||||
if let Some(waker) = waker {
|
||||
let mut ctx = Context::from_waker(waker);
|
||||
ready!(crate::trace::trace_leaf(&mut ctx));
|
||||
std::task::ready!(crate::trace::trace_leaf(&mut ctx));
|
||||
}
|
||||
return Poll::Ready(());
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ use std::mem::MaybeUninit;
|
||||
use std::pin::Pin;
|
||||
use std::sync::atomic::Ordering::{self, AcqRel, Acquire};
|
||||
use std::task::Poll::{Pending, Ready};
|
||||
use std::task::{Context, Poll, Waker};
|
||||
use std::task::{ready, Context, Poll, Waker};
|
||||
|
||||
/// Sends a value to the associated [`Receiver`].
|
||||
///
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::task::Poll;
|
||||
use std::task::{ready, Poll};
|
||||
|
||||
/// Consumes a unit of budget and returns the execution back to the Tokio
|
||||
/// runtime *if* the task's coop budget was exhausted.
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::runtime::context;
|
||||
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Yields execution back to the Tokio runtime.
|
||||
///
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::util::trace;
|
||||
use std::future::Future;
|
||||
use std::panic::Location;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
/// Creates new [`Interval`] that yields with interval of `period`. The first
|
||||
/// tick completes immediately. The default [`MissedTickBehavior`] is
|
||||
|
||||
@@ -6,7 +6,7 @@ use pin_project_lite::pin_project;
|
||||
use std::future::Future;
|
||||
use std::panic::Location;
|
||||
use std::pin::Pin;
|
||||
use std::task::{self, Poll};
|
||||
use std::task::{self, ready, Poll};
|
||||
|
||||
/// Waits until `deadline` is reached.
|
||||
///
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
#![cfg(feature = "full")]
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures::ready;
|
||||
use tokio::io::{self, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, ReadBuf};
|
||||
use tokio_test::assert_ok;
|
||||
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use std::task::{ready, Context, Poll};
|
||||
|
||||
#[tokio::test]
|
||||
async fn copy() {
|
||||
|
||||
Reference in New Issue
Block a user