Skip to content

Instantly share code, notes, and snippets.

@Sgeo
Created March 18, 2016 01:41
Show Gist options
  • Save Sgeo/eaafefac1bbeef4b0550 to your computer and use it in GitHub Desktop.
Save Sgeo/eaafefac1bbeef4b0550 to your computer and use it in GitHub Desktop.
extern crate take_mut;
let mut a = 5i32;
let mut b = 6i32;
take_mut::scope(|scope| {
let (a_val, a_hole) = scope.take(&mut a);
let (b_val, b_hole) = scope.take(&mut b);
b_hole.fill(a_val);
a_hole.fill(b_val);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment