Created
July 3, 2020 00:24
-
-
Save brandonros/d0f4766e913a628a8f86c91c6656c4e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Brandons-MacBook-Pro-2:can-utils-rs brandonros$ cargo build | |
Compiling can-utils-rs v0.0.1 (/Users/brandonros/Desktop/can-utils-rs) | |
error[E0382]: use of moved value: `frame` | |
--> src/main.rs:57:65 | |
| | |
55 | let mut handler = move |frame: Vec<u8>| { | |
| ----- move occurs because `frame` has type `std::vec::Vec<u8>`, which does not implement the `Copy` trait | |
56 | for websocket in websockets.lock().unwrap().iter() { | |
57 | let binary_frame = tungstenite::Message::Binary(frame); | |
| ^^^^^ value moved here, in previous iteration of loop | |
error[E0596]: cannot borrow `*websocket` as mutable, as it is behind a `&` reference | |
--> src/main.rs:58:17 | |
| | |
56 | for websocket in websockets.lock().unwrap().iter() { | |
| --------------------------------- this iterator yields `&` references | |
57 | let binary_frame = tungstenite::Message::Binary(frame); | |
58 | websocket.write_message(binary_frame).unwrap(); | |
| ^^^^^^^^^ `websocket` is a `&` reference, so the data it refers to cannot be borrowed as mutable | |
error[E0382]: use of moved value: `websocket` | |
--> src/main.rs:39:29 | |
| | |
36 | let mut websocket = tungstenite::server::accept(stream.unwrap()).unwrap(); | |
| ------------- move occurs because `websocket` has type `tungstenite::WebSocket<std::net::TcpStream>`, which does not implement the `Copy` trait | |
37 | websockets.lock().unwrap().push(websocket); | |
| --------- value moved here | |
38 | // read from socket, send to evice | |
39 | std::thread::spawn (move || { | |
| ^^^^^^^ value used here after move | |
40 | loop { | |
41 | let msg = websocket.read_message().unwrap().into_data(); | |
| --------- use occurs due to use in closure | |
error[E0382]: use of moved value: `device_handle` | |
--> src/main.rs:39:29 | |
| | |
30 | let device_handle = devices::tactrix_openport::new(); | |
| ------------- move occurs because `device_handle` has type `rusb::device_handle::DeviceHandle<rusb::context::GlobalContext>`, which does not implement the `Copy` trait | |
... | |
39 | std::thread::spawn (move || { | |
| ^^^^^^^ value moved into closure here, in previous iteration of loop | |
... | |
49 | devices::tactrix_openport::send_can_frame(&device_handle, arbitration_id, data); | |
| ------------- use occurs due to use in closure | |
error: aborting due to 4 previous errors | |
Some errors have detailed explanations: E0382, E0596. | |
For more information about an error, try `rustc --explain E0382`. | |
error: could not compile `can-utils-rs`. | |
To learn more, run the command again with --verbose. | |
Brandons-MacBook-Pro-2:can-utils-rs brandonros$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment