Struct alloc::rc::Weak
[−]
[src]
pub struct Weak<T: ?Sized> {
// some fields omitted
}Unstable
: Weak pointers may not belong in this module.
Methods
impl<T: ?Sized> Weak<T>
fn upgrade(&self) -> Option<Rc<T>>
Unstable
: Weak pointers may not belong in this module.
Upgrades a weak reference to a strong reference.
Upgrades the Weak<T>`Weakreference to an` reference to an Rc<T>`Rc
Returns None`None` if there were no strong references and the data was
destroyed.
Examples
use std::rc::Rc; let five = Rc::new(5); let weak_five = five.downgrade(); let strong_five: Option<Rc<_>> = weak_five.upgrade();