feat: add async study

This commit is contained in:
2022-03-19 10:47:04 +08:00
parent 3486a5aae2
commit 0534c43968
6 changed files with 399 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
#[tokio::main]
async fn main() {
invoke().await
}
struct FutureImpl {}
impl Future for FutureImpl {
type Output = ();
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
println!("Hello World!");
Poll::Ready(())
}
}
fn invoke() -> impl Future<Output=()> {
FutureImpl {}
}