[][src]Trait zerogc::GcBindHandle

pub unsafe trait GcBindHandle<'new_gc, T: GcSafe + ?Sized>: GcHandle<T> where
    T: GcBrand<'new_gc, Self::System>,
    <T as GcBrand<'new_gc, Self::System>>::Branded: GcSafe
{ type System: GcSystem; type Bound: GcRef<'new_gc, <T as GcBrand<'new_gc, Self::System>>::Branded>; fn bind_to(&self, context: &'new_gc Self::Context) -> Self::Bound; }

Trait for binding GcHandles to contexts using GcBindHandle::bind_to

This is separate from the GcHandle trait because Rust doesn't have Generic Associated Types

TODO: Remove when we get more powerful types

Associated Types

type System: GcSystem

The type of the system used with this handle

type Bound: GcRef<'new_gc, <T as GcBrand<'new_gc, Self::System>>::Branded>

A garbage collected reference that has been bound to a context with the lifetime new_gc

Loading content...

Required methods

fn bind_to(&self, context: &'new_gc Self::Context) -> Self::Bound

Associate this handle with the specified context, allowing its underlying object to be accessed as long as the context is valid.

The underlying object can be accessed just like any other object that would be allocated from the context. It'll be properly collected and can even be used as a root at the next safepoint.

Loading content...

Implementors

Loading content...