Struct alloc::rc::Rc
[−]
[src]
pub struct Rc<T: ?Sized> { // some fields omitted }
A reference-counted pointer type over an immutable value.
See the module level documentation for more details.
Methods
impl<T> Rc<T>
impl<T: ?Sized> Rc<T>
fn downgrade(&self) -> Weak<T>
: Weak pointers may not belong in this module
Downgrades the Rc<T>
to a Weak<T>
reference.
Examples
use std::rc::Rc; let five = Rc::new(5); let weak_five = five.downgrade();
impl<T: Clone> Rc<T>
fn make_unique(&mut self) -> &mut T
Make a mutable reference from the given Rc<T>
.
This is also referred to as a copy-on-write operation because the inner data is cloned if the reference count is greater than one.
Examples
use std::rc::Rc; let mut five = Rc::new(5); let mut_five = five.make_unique();