error[E0596]: cannot borrow `self.rx_nonce_data` as mutable, as `self` is not declared as mutable
--> src/miner.rs:404:36
|
330 | pub fn run(self) {
| ---- help: consider changing this to be mutable: `mut self`
...
404 | while let Some(item) = self.rx_nonce_data.next().await {
| ^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
error[E0382]: use of moved value: `self`
--> src/miner.rs:403:31
|
399 | let account_id_to_target_deadline = self.account_id_to_target_deadline;
| ---------------------------------- value moved here
...
403 | task::spawn(async move{
| _______________________________^
404 | | while let Some(item) = self.rx_nonce_data.next().await {
| | ---- use occurs due to use in generator
405 | |
406 | | } });
| |___________^ value used here after partial move
|
= note: move occurs because `self.account_id_to_target_deadline` has type `std::collections::HashMap<u64, u64>`, which does not implement the `Copy` trait
let mut rx_nonce_data = self.rx_nonce_data;
task::spawn(async move {
while let Some(nonce_data) = rx_nonce_data.next().await {
}
});
but if i change self.rx_nonce_data the code will be wrong
task::spawn(async move {
while let Some(nonce_data) = self.rx_nonce_data.next().await {
}
});
error[E0596]: cannot borrow `self.rx_nonce_data` as mutable, as `self` is not declared as mutable
--> src/miner.rs:405:42
|
330 | pub fn run(self) {
| ---- help: consider changing this to be mutable: `mut self`
...
405 | while let Some(nonce_data) = self.rx_nonce_data.next().await {
| ^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
error[E0382]: use of moved value: `self`
--> src/miner.rs:404:32
|
399 | let account_id_to_target_deadline = self.account_id_to_target_deadline;
| ---------------------------------- value moved here
...
404 | task::spawn(async move {
| ________________________________^
405 | | while let Some(nonce_data) = self.rx_nonce_data.next().await {
| | ---- use occurs due to use in generator
406 | |
407 | | }
408 | |
409 | | });
| |_________^ value used here after partial move
|
= note: move occurs because `self.account_id_to_target_deadline` has type `std::collections::HashMap<u64, u64>`, which does not implement the `Copy` trait