Vec <t>的Option :: take()等效于什么?

时间:2019-05-20 01:01:33

标签: rust

struct A {
    pub v: Vec<i32>
}

fn extract(a: &mut A) -> Vec<i32> {
    let res = a.v.clone(); // TODO: move out of a.v
    res
}

如何在Vec<T>结构内移出&mut

这是How can I swap in a new value for a field in a mutable reference to a structure?

的副本

0 个答案:

没有答案