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
  • 12,263
  • 15
  • 41
  • 88
amin
  • 3,252
  • 4
  • 29
  • 56

0 Answers0