Trait zerogc_context::state::CollectionManager[][src]

pub unsafe trait CollectionManager<C>: Sealed where
    C: RawCollectorImpl<Manager = Self, RawContext = Self::Context>, 
{ type Context: RawContext<C>; fn new() -> Self;
fn is_collecting(&self) -> bool;
fn should_trigger_collection(&self) -> bool;
unsafe fn freeze_context(&self, context: &Self::Context);
unsafe fn unfreeze_context(&self, context: &Self::Context);
fn prevent_collection<R>(collector: &C, func: impl FnOnce() -> R) -> R;
unsafe fn free_context(collector: &C, context: *mut Self::Context); }
Expand description

Manages coordination of garbage collections

Associated Types

Required methods

fn new() -> Self[src]

fn is_collecting(&self) -> bool[src]

fn should_trigger_collection(&self) -> bool[src]

unsafe fn freeze_context(&self, context: &Self::Context)[src]

unsafe fn unfreeze_context(&self, context: &Self::Context)[src]

fn prevent_collection<R>(collector: &C, func: impl FnOnce() -> R) -> R[src]

Expand description

Attempt to prevent garbage collection for the duration of the closure

This method is OPTIONAL and will panic if unimplemented.

unsafe fn free_context(collector: &C, context: *mut Self::Context)[src]

Expand description

Free the specified context

Safety

  • Assumes the specified pointer is valid
  • Assumes there are no more outstanding borrows to values in the context

Implementors

impl<C> CollectionManager<C> for zerogc_context::state::nosync::CollectionManager<C> where
    C: RawCollectorImpl<Manager = Self, RawContext = RawContext<C>>, 
[src]

type Context = RawContext<C>

fn new() -> Self[src]

fn is_collecting(&self) -> bool[src]

fn should_trigger_collection(&self) -> bool[src]

unsafe fn freeze_context(&self, context: &RawContext<C>)[src]

unsafe fn unfreeze_context(&self, _context: &RawContext<C>)[src]

fn prevent_collection<R>(_collector: &C, _func: impl FnOnce() -> R) -> R[src]

unsafe fn free_context(_collector: &C, _context: *mut Self::Context)[src]

impl<C> CollectionManager<C> for zerogc_context::state::sync::CollectionManager<C> where
    C: SyncCollector,
    C: RawCollectorImpl<Manager = Self, RawContext = RawContext<C>>, 
[src]

type Context = RawContext<C>

fn new() -> Self[src]

fn is_collecting(&self) -> bool[src]

fn should_trigger_collection(&self) -> bool[src]

unsafe fn freeze_context(&self, context: &RawContext<C>)[src]

unsafe fn unfreeze_context(&self, context: &RawContext<C>)[src]

fn prevent_collection<R>(collector: &C, func: impl FnOnce() -> R) -> R[src]

unsafe fn free_context(collector: &C, context: *mut Self::Context)[src]