title: Copying vector of structures
body: <p>I am implementing a Rust application where the vector of structures are to be passed into a closure.</p>
  
  <pre><code>#[derive(Clone, Copy)]
  struct AttackInfo {
      ppid: usize,
      pname: &amp;'static str,
      cpu: f32,
  }
  
  type AList = Vec&lt;AttackInfo&gt;;
  
  fn Task() {
      let mut list: AList = AList::new();
  
      // ...
      // I fill up the list with many items
      // ...
  
      output.put(|msg| *msg = Some(Message::Value(list)));
  }
  </code></pre>
  
  <p><code>output.put</code> is a function that takes a closure, this is defined by the library.</p>
  
  <p>I am unable to send the value of list because of the error for the <code>list</code> variable:</p>
  
  <pre class="lang-none prettyprint-override"><code>cannot move out of captured outer variable in an `FnMut` closure
  </code></pre>
  
  <p>The closure will be executed multiple times until all the values in the list are emptied. How can I send the list data without losing the scope of the variable?</p>