Guest User

Untitled

a guest
Sep 24th, 2018
117
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::rc::Rc;
  2. use std::cell::RefCell;
  3.  
  4. struct Node;
  5.  
  6. impl Node {
  7. fn mutate(&mut self) {}
  8. }
  9.  
  10. fn foo(left: RefCell<Option<Rc<Node>>>) {
  11. if let Some(node) = &mut *left.borrow_mut() {
  12. Rc::get_mut(node).unwrap().mutate();
  13. }
  14. }
Add Comment
Please, Sign In to add comment