Hi!
I want one thread to read stick events, another one to pick up the latest read event and send it off on a network socket. For networking purposes I'm using tokio, not pasts crate.
The issue is, I can't spawn a task with tokio as Controller has an Rc inside and rust is unhappy about it not being Send.
Here's the gist of the code:
let mut state = State::new(...);
let mut controller = get_ctl().await;
tokio::spawn(async move { // => error here => future created by async block is not `Send`
loop {
let event = (&mut controller).await; // => also error => has type `Controller` which is not `Send`
state.event(event);
}
});
(Please forgive any stupid usage of rust / tokio / stick / async, I'm a newbie to both rust and async!)
Can you please guide me on how to achieve this? how should I send a controller through an async task? does this require fundamental changes to stick to use Arc?
Hi!
I want one thread to read stick events, another one to pick up the latest read event and send it off on a network socket. For networking purposes I'm using tokio, not pasts crate.
The issue is, I can't spawn a task with tokio as
Controllerhas anRcinside and rust is unhappy about it not beingSend.Here's the gist of the code:
(Please forgive any stupid usage of rust / tokio / stick / async, I'm a newbie to both rust and async!)
Can you please guide me on how to achieve this? how should I send a controller through an async task? does this require fundamental changes to
stickto useArc?