Type Definition jrsonnet_gcmodule::Cc

source · []
pub type Cc<T> = RawCc<T, ObjectSpace>;
Expand description

A single-threaded reference-counting pointer that integrates with cyclic garbage collection.

See module level documentation for more details.

Cc is not thread-safe. It does not implement Send or Sync:

use std::ops::Deref;
use gcmodule::Cc;
let cc = Cc::new(5);
std::thread::spawn(move || {
    println!("{}", cc.deref());
});

Implementations

Constructs a new Cc<T> in a thread-local storage.

To collect cycles, use collect_thread_cycles.

Update the value T in a copy-on-write way.

If the ref count is 1, the value is updated in-place. Otherwise a new Cc<T> will be created.

Trait Implementations

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Define how to visit values referred by this value. Read more

Whether this type should be tracked by the collector. Read more

Define how to visit values referred by this value. Read more

Whether this type should be tracked by the collector. Read more