[][src]Struct bacon_rajan_cc::Weak

pub struct Weak<T: Trace> { /* fields omitted */ }

A weak version of Cc<T>.

Weak references do not count when determining if the inner value should be dropped.

See the module level documentation for more.

Methods

impl<T: Trace> Weak<T>[src]

pub fn upgrade(&self) -> Option<Cc<T>>[src]

Upgrades a weak reference to a strong reference.

Upgrades the Weak<T> reference to an Cc<T>, if possible.

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

Examples

use bacon_rajan_cc::Cc;

let five = Cc::new(5);

let weak_five = five.downgrade();

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

Trait Implementations

impl<T: Trace> Trace for Weak<T>[src]

impl<T: Trace> Clone for Weak<T>[src]

fn clone(&self) -> Weak<T>[src]

Makes a clone of the Weak<T>.

This increases the weak reference count.

Examples

use bacon_rajan_cc::Cc;

let weak_five = Cc::new(5).downgrade();

weak_five.clone();

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Trace> Drop for Weak<T>[src]

fn drop(&mut self)[src]

Drops the Weak<T>.

This will decrement the weak reference count.

Examples

use bacon_rajan_cc::Cc;

{
    let five = Cc::new(5);
    let weak_five = five.downgrade();

    // stuff

    drop(weak_five); // explicit drop
}
{
    let five = Cc::new(5);
    let weak_five = five.downgrade();

    // stuff

} // implicit drop

impl<T: Debug + Trace> Debug for Weak<T>[src]

Auto Trait Implementations

impl<T> Unpin for Weak<T> where
    T: Unpin

impl<T> !Sync for Weak<T>

impl<T> !Send for Weak<T>

impl<T> !UnwindSafe for Weak<T>

impl<T> !RefUnwindSafe for Weak<T>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]