Struct alloc::rc::Weak
[−]
[src]
pub struct Weak<T: ?Sized> { // some fields omitted }
: Weak pointers may not belong in this module.
A weak version of Rc<T>
`Rc
Weak references do not count when determining if the inner value should be dropped.
See the module level documentation for more.
Methods
impl<T: ?Sized> Weak<T>
fn upgrade(&self) -> Option<Rc<T>>
: Weak pointers may not belong in this module.
Upgrades a weak reference to a strong reference.
Upgrades the Weak<T>
`Weakreference to an
Rc
Returns None
`None` if there were no strong references and the data was
destroyed.
Examples
#![feature(rc_weak)] use std::rc::Rc; let five = Rc::new(5); let weak_five = five.downgrade(); let strong_five: Option<Rc<_>> = weak_five.upgrade();