Crate side_futures[−][src]
Expand description
This crate provides an ability to send future for execution on the runtime that may be in a different thread. Typical use case is heavily threaded application where there are synchronous callbacks, but some asynchronous tasks also need to be executed.
Typical usage with Tokio runtime:
use tokio::task; #[tokio::main] async fn main() { let (sender, receiver) = side_futures::create(); task::spawn(receiver.run_receiver(task::spawn)); sender .send_future(async { // Do stuff }) .unwrap(); }
Typical usage with Actix runtime:
#[actix_rt::main] async fn main() { let (sender, receiver) = side_futures::create(); actix_rt::spawn(receiver.run_receiver(actix_rt::spawn)); sender .send_future(async { // Do stuff }) .unwrap(); }
Structs
FuturesReceiver | Receiver channel for futures sent with sender, can be used to run received futures manually or
(most likely) using |
FuturesSender | Sender channel for futures to be received and spawned as executor tasks by receiver. Can be used
to send futures manually or (most likely) using |
Functions
create |