Guest User

Untitled

a guest
Mar 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. use std::cell::Cell;
  2.  
  3. #[derive(Debug)]
  4. struct NonCopyBool(bool);
  5.  
  6. fn main() {
  7. let flag = Cell::new(NonCopyBool(false));
  8.  
  9. let c1 = || flag.set(NonCopyBool(true));
  10.  
  11. let c2 = || println!("{:?}", flag.replace(NonCopyBool(false)));
  12.  
  13. c1();
  14. c2();
  15. }
Add Comment
Please, Sign In to add comment