Struct bacon_rajan_cc::Weak

source ·
pub struct Weak<T: Trace> { /* private fields */ }
Expand description

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.

Implementations§

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§

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();
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

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
Invoke the Tracer on each of the CcBoxPtrs owned by this Trace instance. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.