title: Cannot move out of captured variables in an `FnMut` closure
body: <pre><code>pub fn create_future(
      notificator: mpsc::Sender&lt;usize&gt;,
      proxy: Proxy,
  ) -&gt; impl Future&lt;Item = (), Error = ()&gt; {
      proxy.something()
          .and_then(move |sub| {
              sub.for_each(move |a| { // &lt;---- Closure A
                  proxy.something_else(a)
                      .and_then(move |b| { // &lt;---- Closure B
                          notificator.send(b.len());  // &lt;---- Error!
                          Ok(())
                      })
                      .or_else(|e| {
                          panic!("oops {}", e);
                          Ok(())
                      })
              })
          })
          .map_err(|e| {
              ()
          })
  }
  </code></pre>
  
  <p>This doesn't compile because</p>
  
  <pre class="lang-none prettyprint-override"><code>.and_then(move |b| {
            ^^^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure
  </code></pre>
  
  <p>My understanding of the error is:</p>
  
  <ol>
  <li>Closure B is <code>FnMut</code>, and it captures <code>notificator</code> by taking its ownership</li>
  <li>In Closure B, <code>send</code> again needs to take the ownership</li>
  <li>Now both <code>send</code> and Closure B are modifying <code>notificator</code> thus the error.</li>
  </ol>
  
  <p>Is my understanding right? How can I solve this problem?</p>