fn other_thread(sink: ExtEventSink, rx: Receiver<Request>) {
    let rt = runtime::Builder::new_current_thread()
        .enable_all()
        .build()
        .unwrap();
    rt.block_on(async {
        let rx = rx.stream();
        rx.for_each(|req| {
            let sink = sink.clone();
            rt.spawn(async move {
                let res = req.future.await;
                let res = Response { value: res };
                let sender = req.sender;

                sink.submit_command(ASYNC_RESPONSE, SingleUse::new(res), Target::Widget(sender))
                    .unwrap();
            });
            future::ready(())
        })
        .await;
    });
}
// TODO: make this work with other runtimes
make this work with other runtimes
make this work with other runtimes
fn other_thread(sink: ExtEventSink, rx: Receiver<Request>) {
    let rt = runtime::Builder::new_current_thread()
        .enable_all()
        .build()
        .unwrap();
    rt.block_on(async {
        let rx = rx.stream();
        rx.for_each(|req| {
            let sink = sink.clone();
            rt.spawn(async move {
                let res = req.future.await;
                let res = Response { value: res };
                let sender = req.sender;
                sink.submit_command(ASYNC_RESPONSE, SingleUse::new(res), Target::Widget(sender))
                    .unwrap();
            });
            future::ready(())
        })
        .await;
    });
}
fn other_thread ( sink : ExtEventSink , rx : Receiver < Request > ) { let rt = runtime :: Builder :: new_current_thread ( ) . enable_all ( ) . build ( ) . unwrap ( ) ; rt . block_on ( async { let rx = rx . stream ( ) ; rx . for_each ( | req | { let sink = sink . clone ( ) ; rt . spawn ( async move { let res = req . future . await ; let res = Response { value : res } ; let sender = req . sender ; sink . submit_command ( ASYNC_RESPONSE , SingleUse :: new ( res ) , Target :: Widget ( sender ) ) . unwrap ( ) ; } ) ; future :: ready ( ( ) ) } ) . await ; } ) ; }
TODO: make this work with other runtimes
TODO : make this work with other runtimes
sink
ExtEventSink
rx
Receiver<Request>