Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created January 11, 2020 15:49
Show Gist options
  • Save rust-play/ab9d3bbab87182aaad34fd1069e69471 to your computer and use it in GitHub Desktop.
Save rust-play/ab9d3bbab87182aaad34fd1069e69471 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
// Comented code work with nightly
//#![feature(type_alias_impl_trait)]
trait InterfaceThing {
type Result: 'static;
fn do_work() -> Self::Result;
}
struct Z{}
impl InterfaceThing for Z {
// type Result = impl std::future::Future;
type Result = Box<dyn std::future::Future<Output = u8>>;
fn do_work() -> Self::Result {
// async {5}
Box::new(async {5})
}
}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment