Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #![feature(async_await)]
  2. use std::future::Future;
  3. use std::task::{Context, Poll};
  4. use std::pin::Pin;
  5.  
  6. struct Five;
  7.  
  8. impl Future for Five {
  9. type Output = i32;
  10.  
  11. fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
  12. Poll::Ready(5)
  13. }
  14. }
  15.  
  16. fn returns_five() -> impl Future<Output=i32> {
  17. Five
  18. }
  19.  
  20. async fn testing() {
  21. returns_five().await;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement