1
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
}

How to move out a Vec<T> while it's inside a &mut struct?

pretzelhammer
  • 13,874
  • 15
  • 47
  • 98
amin
  • 3,672
  • 5
  • 33
  • 61

0 Answers0