Struct alloc::arc::Weak [] [src]

pub struct Weak<T> {
    // some fields omitted
}
Unstable

: Weak pointers may not belong in this module.

A weak pointer to an Arc`Arc`.

Weak pointers will not keep the data inside of the Arc`Arcalive, and can be used to break cycles between` alive, and can be used to break cycles between Arc`Arc` pointers.

Methods

impl<T> Weak<T>

fn upgrade(&self) -> Option<Arc<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 Arc<T>`Arc`, if possible.

Returns None`None` if there were no strong references and the data was destroyed.

Examples

use std::sync::Arc;

let five = Arc::new(5);

let weak_five = five.downgrade();

let strong_five: Option<Arc<_>> = weak_five.upgrade();

Trait Implementations

impl<T: Sync + Send> Send for Weak<T>

impl<T: Sync + Send> Sync for Weak<T>

impl<T: Debug> Debug for Weak<T>

fn fmt(&self, f: &mut Formatter) -> Result

impl<T> Clone for Weak<T>

fn clone(&self) -> Weak<T>

fn clone_from(&mut self, source: &Self)

impl<T> Drop for Weak<T>

fn drop(&mut self)