about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-07-29 06:11:41 +0900
committerGitHub <noreply@github.com>2021-07-29 06:11:41 +0900
commitfef1725c0f60616e62b75342ce96412748544725 (patch)
treed8cf2719d7c57a32ef1176534fd8e7d2dc6bb223 /src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parenta28109a7679fbb254ca0962865a8b32b91ddbbd9 (diff)
parent18cc06c848ec2707c3593f8e2ea6e7090e17ff16 (diff)
downloadrust-fef1725c0f60616e62b75342ce96412748544725.tar.gz
rust-fef1725c0f60616e62b75342ce96412748544725.zip
Rollup merge of #81050 - yoshuawuyts:stabilize-task-ready, r=m-ou-se
Stabilize core::task::ready!

_Tracking issue: https://github.com/rust-lang/rust/issues/70922_

This PR stabilizes the `task::ready!` macro. Similar to https://github.com/rust-lang/rust/pull/80886, this PR was waiting on https://github.com/rust-lang/rust/issues/74355 to be fixed.

The `task::ready!` API has existed in the futures ecosystem for several years, and was added on nightly last year in https://github.com/rust-lang/rust/pull/70817. The motivation for this macro is the same as it was back then: virtually every single manual future implementation makes use of this; so much so that it's one of the few things included in the [futures-core](https://docs.rs/futures-core/0.3.12/futures_core) library.

r? ``@tmandry``

cc/ ``@rust-lang/wg-async-foundations`` ``@rust-lang/libs``

## Example
```rust
use core::task::{Context, Poll};
use core::future::Future;
use core::pin::Pin;

async fn get_num() -> usize {
    42
}

pub fn do_poll(cx: &mut Context<'_>) -> Poll<()> {
    let mut f = get_num();
    let f = unsafe { Pin::new_unchecked(&mut f) };

    let num = ready!(f.poll(cx));
    // ... use num

    Poll::Ready(())
}
```
Diffstat (limited to 'src/test/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions