Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(async_await, futures_api)]
- use std::future::Future;
- async fn func() -> Result<(), ()> {
- Ok(())
- }
- trait MyTrait {
- type Future: Future;
- fn start(&mut self) -> Self::Future;
- }
- impl<F: Future> MyTrait for fn() -> F {
- type Future = F;
- fn start(&mut self) -> Self::Future {
- (self)()
- }
- }
- fn main() {
- //let f: () = func;
- use_my_trait(func)
- }
- fn use_my_trait<T: MyTrait>(t: T) {}
Add Comment
Please, Sign In to add comment