about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-10 23:26:24 -0700
committerGitHub <noreply@github.com>2020-07-10 23:26:24 -0700
commitd82588b45aa866418a3cc88924e939015fd1bd1c (patch)
treeeed55c32d102df6ab06e88937e385ac7e04a1a88 /src/test/debuginfo/enum-thinlto.rs
parentec1e7e9dbc83e57da7809cfc32c01e881b42555b (diff)
parenta31f103fd27bde3f83b9dd54af8e41d64e5001f4 (diff)
downloadrust-d82588b45aa866418a3cc88924e939015fd1bd1c.tar.gz
rust-d82588b45aa866418a3cc88924e939015fd1bd1c.zip
Rollup merge of #72303 - yoshuawuyts:future-poll-fn, r=dtolnay
Add core::future::{poll_fn, PollFn}

This is a sibling PR to #70834, adding `future::poll_fn`. This is a small helper function that helps bridge the gap between "poll state machines" and "async/await". It was first introduced in [futures@0.1.7](https://docs.rs/futures/0.1.7/futures/future/fn.poll_fn.html) in December of 2016, and has been tried and tested as part of the ecosystem for the past 3.5 years.

## Implementation

Much of the same reasoning from #70834 applies: by returning a concrete struct rather than an `async fn` we get to mark the future as `Unpin`. It also becomes named which allows storing it in structs without boxing. This implementation has been modified from the implementation in `futures-rs`.

## References
- [`futures::future::poll_fn`](https://docs.rs/futures/0.3.5/futures/future/fn.poll_fn.html)
- [`async_std::future::poll_fn`](https://docs.rs/async-std/1.5.0/async_std/future/fn.poll_fn.html)
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions