First of all, I want to say I've just started experimented with Rust so I apologize if there are obvious design decisions in rust or this crate that make the following issue just a dumb newbie mistake.
I decided to make a simple change to examples/async-client.rs by simply wrapping the runner/core.run code in another spawned thread call. The idea being that the main thread is now free to do other things instead of blocking on core.run(runner).unwrap().
error[E0277]: the trait bound `std::rc::Rc<std::cell::RefCell<tokio_core::reactor::Inner>>: std::marker::Send` is not satisfied in `[closure@examples/async-client.rs:47:19: 66:6 core:tokio_core::reactor::Core, stdin_ch:futures::sync::mpsc::Receiver<websocket::OwnedMessage>]`
--> examples/async-client.rs:47:5
|
47 | thread::spawn(move || {
| ^^^^^^^^^^^^^ `std::rc::Rc<std::cell::RefCell<tokio_core::reactor::Inner>>` cannot be sent between threads safely
|
= help: within `[closure@examples/async-client.rs:47:19: 66:6 core:tokio_core::reactor::Core, stdin_ch:futures::sync::mpsc::Receiver<websocket::OwnedMessage>]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::RefCell<tokio_core::reactor::Inner>>`
= note: required because it appears within the type `tokio_core::reactor::Core`
= note: required because it appears within the type `[closure@examples/async-client.rs:47:19: 66:6 core:tokio_core::reactor::Core, stdin_ch:futures::sync::mpsc::Receiver<websocket::OwnedMessage>]`
= note: required by `std::thread::spawn`
First of all, I want to say I've just started experimented with Rust so I apologize if there are obvious design decisions in rust or this crate that make the following issue just a dumb newbie mistake.
I decided to make a simple change to examples/async-client.rs by simply wrapping the runner/core.run code in another spawned thread call. The idea being that the main thread is now free to do other things instead of blocking on
core.run(runner).unwrap()
.Instead I get the following compilation errors: