Function std::rc::get_mutUnstable
[-] [+]
[src]
pub fn get_mut<T>(rc: &'a mut Rc<T>) -> Option<&'a mut T>
Returns a mutable reference to the contained value if the Rc<T> is unique.
Returns None if the Rc<T> is not unique.
Examples
#![feature(alloc)] extern crate std; fn main() { use std::rc::{self, Rc}; let mut x = Rc::new(3); *rc::get_mut(&mut x).unwrap() = 4; assert_eq!(*x, 4); let _y = x.clone(); assert!(rc::get_mut(&mut x).is_none()); }use std::rc::{self, Rc}; let mut x = Rc::new(3); *rc::get_mut(&mut x).unwrap() = 4; assert_eq!(*x, 4); let _y = x.clone(); assert!(rc::get_mut(&mut x).is_none());