use futures::executor::block_on; use rand::prelude::*; trait SimpleFuture { type Output; fn poll(&mut self, wake: fn()) -> Poll; } enum Poll { Ready(T), Pending, } pub struct RandomFuture {} impl SimpleFuture for RandomFuture { type Output = f64; fn poll(&mut self, _wake: fn()) -> Poll { let mut rng = rand::thread_rng(); let y: f64 = rng.gen(); println!("y value {}", y); if y > 0.9 { Poll::Ready(y) } else { // probably need to utilize wake() here Poll::Pending } } } async fn hello_world() { println!("hello, world!"); } fn main() { let future = hello_world(); block_on(future); }