mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Rollup merge of #99306 - JohnTitor:stabilize-future-poll-fn, r=joshtriplett
Stabilize `future_poll_fn` FCP is done: https://github.com/rust-lang/rust/issues/72302#issuecomment-1179620512 Closes #72302 r? `@joshtriplett` as you started FCP Signed-off-by: Yuki Okushi <jtitor@2k36.org>
This commit is contained in:
commit
50527690e2
@ -15,7 +15,7 @@ use crate::task::{Context, Poll};
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(future_join, future_poll_fn)]
|
||||
/// #![feature(future_join)]
|
||||
///
|
||||
/// use std::future::join;
|
||||
///
|
||||
@ -31,7 +31,7 @@ use crate::task::{Context, Poll};
|
||||
/// `join!` is variadic, so you can pass any number of futures:
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(future_join, future_poll_fn)]
|
||||
/// #![feature(future_join)]
|
||||
///
|
||||
/// use std::future::join;
|
||||
///
|
||||
|
@ -37,7 +37,7 @@ pub use pending::{pending, Pending};
|
||||
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
|
||||
pub use ready::{ready, Ready};
|
||||
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
pub use poll_fn::{poll_fn, PollFn};
|
||||
|
||||
/// This type is needed because:
|
||||
|
@ -10,7 +10,6 @@ use crate::task::{Context, Poll};
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(future_poll_fn)]
|
||||
/// # async fn run() {
|
||||
/// use core::future::poll_fn;
|
||||
/// use std::task::{Context, Poll};
|
||||
@ -23,7 +22,7 @@ use crate::task::{Context, Poll};
|
||||
/// assert_eq!(read_future.await, "Hello, World!".to_owned());
|
||||
/// # }
|
||||
/// ```
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
pub fn poll_fn<T, F>(f: F) -> PollFn<F>
|
||||
where
|
||||
F: FnMut(&mut Context<'_>) -> Poll<T>,
|
||||
@ -36,22 +35,22 @@ where
|
||||
/// This `struct` is created by [`poll_fn()`]. See its
|
||||
/// documentation for more.
|
||||
#[must_use = "futures do nothing unless you `.await` or poll them"]
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
pub struct PollFn<F> {
|
||||
f: F,
|
||||
}
|
||||
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
impl<F> Unpin for PollFn<F> {}
|
||||
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
impl<F> fmt::Debug for PollFn<F> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("PollFn").finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "future_poll_fn", issue = "72302")]
|
||||
#[stable(feature = "future_poll_fn", since = "1.64.0")]
|
||||
impl<T, F> Future for PollFn<F>
|
||||
where
|
||||
F: FnMut(&mut Context<'_>) -> Poll<T>,
|
||||
|
@ -32,7 +32,6 @@
|
||||
#![feature(fmt_internals)]
|
||||
#![feature(float_minimum_maximum)]
|
||||
#![feature(future_join)]
|
||||
#![feature(future_poll_fn)]
|
||||
#![feature(generic_assert_internals)]
|
||||
#![feature(array_try_from_fn)]
|
||||
#![feature(hasher_prefixfree_extras)]
|
||||
|
Loading…
Reference in New Issue
Block a user