Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. use std::cell::RefCell;
  2.  
  3. thread_local!(static DIR: RefCell<String> = RefCell::new(String::new()));
  4.  
  5. fn main() {
  6. DIR.with(|f| {
  7. f.borrow_mut().push_str("foobar");
  8. });
  9.  
  10. DIR.with(|f| {
  11. println!("{}", *f.borrow());
  12. })
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement