如何将新值转换为可更改的结构引用中的字段?
struct A {
field: SomeType,}&mut Afield
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()
慕田峪9158850
蝴蝶刀刀
有只小跳蛙
随时随地看视频慕课网APP