AZ
Size: a a a
AZ
В
d
fn get(&mut self, key) { ... }
error[E0507]: cannot move out of `self.storage` which is behind a mutable reference
--> src/kv.rs:78:34
|
78 | let commands: Vec<Log> = self.storage
| ^^^^^^^^^^^^ move occurs because `self.storage` has type `T`, which does not implement the `Copy` trait
error: aborting due to previous error
В
error[E0507]: cannot move out of `self.storage` which is behind a mutable reference
--> src/kv.rs:78:34
|
78 | let commands: Vec<Log> = self.storage
| ^^^^^^^^^^^^ move occurs because `self.storage` has type `T`, which does not implement the `Copy` trait
error: aborting due to previous error
self.storage.by_ref().map(...)
?В
error[E0507]: cannot move out of `self.storage` which is behind a mutable reference
--> src/kv.rs:78:34
|
78 | let commands: Vec<Log> = self.storage
| ^^^^^^^^^^^^ move occurs because `self.storage` has type `T`, which does not implement the `Copy` trait
error: aborting due to previous error
impl<I: Iterator> Iterator for &mut I
, т.е. уникальная ссылка на итератор это тоже итераторd
self.storage.by_ref().map(...)
?d
let cmds = self
.storage
.by_ref()
.filter_map(|ref line| match serde_json::from_str(line) {
Ok(cmd) => match &cmd {
Log::Set(k, _) | Log::Remove(k) if &key == k => Some(cmd),
_ => None,
},
Err(_) => None,
});
for cmd in cmds {
entry.run(&cmd);
}
d
impl Iterator for FileStorage {
type Item = String;
fn next(&mut self) -> Option<Self::Item> {
let mut buff = String::new();
match self.reader.read_line(&mut buff) {
Ok(_) => {
Some(buff.trim().to_owned())
},
Err(_) => None,
}
}
}
AZ
impl Iterator for FileStorage {
type Item = String;
fn next(&mut self) -> Option<Self::Item> {
let mut buff = String::new();
match self.reader.read_line(&mut buff) {
Ok(_) => {
Some(buff.trim().to_owned())
},
Err(_) => None,
}
}
}
d
IB
impl Iterator for FileStorage {
type Item = String;
fn next(&mut self) -> Option<Self::Item> {
let mut buff = String::new();
match self.reader.read_line(&mut buff) {
Ok(_) => {
Some(buff.trim().to_owned())
},
Err(_) => None,
}
}
}
d
d
IB
d
IB
d
ML
d
AZ
$ rustup update nightly
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: latest update on 2020-03-27, rust version 1.44.0-nightly (2fbb07525 2020-03-26)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-03-26-x86_64-pc-windows-msvc'
info: latest update on 2020-03-26, rust version 1.44.0-nightly (a5fb9ae5b 2020-03-25)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-03-25-x86_64-pc-windows-msvc'
info: latest update on 2020-03-25, rust version 1.44.0-nightly (02046a5d4 2020-03-24)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-03-24-x86_64-pc-windows-msvc'
info: latest update on 2020-03-24, rust version 1.44.0-nightly (1edd389cc 2020-03-23)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-23-x86_64-pc-windows-msvc'
info: latest update on 2020-03-23, rust version 1.44.0-nightly (d1e81ef23 2020-03-22)
info: skipping nightly which is missing installed component 'rustfmt-preview'
info: syncing channel updates for 'nightly-2020-03-22-x86_64-pc-windows-msvc'
info: latest update on 2020-03-22, rust version 1.44.0-nightly (38114ff16 2020-03-21)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-21-x86_64-pc-windows-msvc'
info: latest update on 2020-03-21, rust version 1.44.0-nightly (1057dc97a 2020-03-20)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-20-x86_64-pc-windows-msvc'
info: latest update on 2020-03-20, rust version 1.44.0-nightly (f4c675c47 2020-03-19)
info: skipping nightly which is missing installed component 'clippy-preview'
info: syncing channel updates for 'nightly-2020-03-19-x86_64-pc-windows-msvc'
nightly-x86_64-pc-windows-msvc unchanged - rustc 1.44.0-nightly (f509b26a7 2020-03-18)
info: checking for self-updates