rust/src/test/ui/async-await/await-into-future.rs
2019-12-27 11:56:11 -08:00

29 lines
411 B
Rust

// check-pass
// edition:2018
#![feature(into_future)]
use std::{future::{Future, IntoFuture}, pin::Pin};
struct AwaitMe;
impl IntoFuture for AwaitMe {
type Output = i32;
type Future = Pin<Box<dyn Future<Output = i32>>>;
fn into_future(self) -> Self::Future {
Box::pin(me())
}
}
async fn me() -> i32 {
41
}
async fn run() {
assert_eq!(AwaitMe.await, 41);
}
fn main() {}