Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::future::Future;
- pub struct Foo {}
- impl Foo {
- pub async fn bar(self) -> Result<i32, ()> {
- Ok(42)
- }
- }
- // Can't use async-std in playground, so here's a shim
- pub fn spawn<F, T>(_future: F) where
- F: Future<Output = T> + Send + 'static,
- T: Send + 'static {
- unimplemented!();
- }
- fn main() {
- let x = Foo {};
- spawn(x.bar());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement