mutable-reference Questions
1
Rust-lang Playground link
struct Foo {
val: i32
}
impl Foo {
pub fn maybe_get(&mut self) -> Option<&mut i32> {
Some(&mut self.val)
}
pub fn definitely_get(&mut self...
Dusky asked 20/1, 2022 at 2:0
1
Solved
When I wondered how a mutable reference could move into a method, all the questions began.
let a = &mut x;
a.somemethod(); // value of a should have moved
a.anothermethod(); // but it works.
I...
Synecdoche asked 28/12, 2020 at 7:19
1
© 2022 - 2024 — McMap. All rights reserved.