如何将新值转换为可更改的结构引用中的字段?
struct A { field: SomeType,}
&mut A
field
fn foo(a: &mut A) { let mut my_local_var = a.field; a.field = SomeType::new(); // ... // do things with my_local_var // some operations may modify the NEW field's value as well.}
get_and_set()
蝴蝶刀刀
有只小跳蛙