Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::cell::Cell;
- #[derive(Debug, Default)]
- struct NonCopyBool(bool);
- fn main() {
- let flag = Cell::new(NonCopyBool(false));
- let c1 = || flag.set(NonCopyBool(true));
- let c2 = || println!("{:?}", flag.take());
- c1();
- c2();
- }
Add Comment
Please, Sign In to add comment