Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
75
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, futures_api, trait_alias, unboxed_closures)]
  2.  
  3. use std::future::Future;
  4.  
  5. trait Foo<'a> = FnOnce<(&'a u8,)> where <Self as FnOnce<(&'a u8,)>>::Output: Future<Output = u8> + 'a;
  6.  
  7. fn foo<F>(f: F) where F: for<'a> Foo<'a> {
  8. let bar = 5;
  9. f(&bar);
  10. }
  11.  
  12. fn main() {
  13. // foo(async move | f: &u8 | { *f });
  14.  
  15. foo({ async fn baz(f: &u8) -> u8 { *f } baz });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement