pub struct ThreadedObjectSpace { /* private fields */ }
Expand description

A collection of tracked ThreadedCc objects that can be garbage collected.

ThreadedObjectSpace is similar to ObjectSpace but works with multi-thread.

Implementations§

Count objects tracked by this ThreadedObjectSpace.

Collect cyclic garbage tracked by this ThreadedObjectSpace. Return the number of objects collected.

Constructs a new ThreadedCc<T> in this ThreadedObjectSpace.

The returned object should not refer to ThreadedCc<T> created by a different ThreadedObjectSpace. Otherwise the collector might fail to collect cycles.

The type T needs to be Send + Sync. This is because the ThreadedObjectSpace is Send and Sync. The collector can run in a different thread to access ThreadedCc<T>, which needs to be Send + Sync to be safely accessed by the collector.

use gcmodule::{ThreadedObjectSpace, ThreadedCc, Cc};
let cc = Cc::new(5);
let space = ThreadedObjectSpace::default();
let tcc: ThreadedCc<Cc<_>> = space.create(cc);

Trait Implementations§

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 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.