title: How do I move a variable out of a closure?
body: <p>I have a simple GTK app and I need to select a folder and pass it's path to a variable outside of the closure.</p>
  
  <pre><code>let mut path = "".to_owned();
  
  button_open.connect_clicked(move |_| {
      let file_chooser = gtk::FileChooserDialog::new(
          "Open File", None, gtk::FileChooserAction::SelectFolder,
          [("Open", gtk::ResponseType::Ok), ("Cancel", gtk::ResponseType::Cancel)]);
      if file_chooser.run() == gtk::ResponseType::Ok as i32 {
          let filename = file_chooser.get_current_folder().unwrap();
      }
  
      file_chooser.destroy();
  });
  </code></pre>
  
  <p>How do I assign <code>filename</code> to <code>path</code>? If I just write</p>
  
  <pre><code>path = filename;
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>src\main.rs:46:13: 46:28 error: cannot assign to captured outer variable in an `Fn` closure
  src\main.rs:46             path = filename;
  </code></pre>