Function alloc::arc::get_mut
[−]
[src]
pub fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T>
Unstable
Returns a mutable reference to the contained value if the Arc<T>
is unique.
Returns None
if the Arc<T>
is not unique.
Examples
extern crate alloc; use alloc::arc::{Arc, get_mut}; let mut x = Arc::new(3); *get_mut(&mut x).unwrap() = 4; assert_eq!(*x, 4); let _y = x.clone(); assert!(get_mut(&mut x).is_none());