Guest User

Untitled

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