We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da23d16 commit 94a6ff3Copy full SHA for 94a6ff3
src/future/poll_fn.rs
@@ -1,5 +1,5 @@
1
-use std::pin::Pin;
2
-use std::future::Future;
+use core::future::Future;
+use core::pin::Pin;
3
4
use crate::task::{Context, Poll};
5
@@ -23,15 +23,18 @@ use crate::task::{Context, Poll};
23
/// #
24
/// # })
25
/// ```
26
-pub async fn poll_fn<F, T>(f: F) -> T
+pub fn poll_fn<F, T>(f: F) -> PollFn<F>
27
where
28
F: FnMut(&mut Context<'_>) -> Poll<T>,
29
{
30
- let fut = PollFn { f };
31
- fut.await
+ PollFn { f }
32
}
33
34
-struct PollFn<F> {
+/// This future is constructed by the [`poll_fn`] function.
+///
35
+/// [`poll_fn`]: fn.poll_fn.html
36
+#[derive(Debug)]
37
+pub struct PollFn<F> {
38
f: F,
39
40
0 commit comments