[][src]Struct glsp::GcVal

pub struct GcVal(_);

Equivalent to Val, except that it stores weak Gc pointers rather than strong Root pointers.

Construct a GcVal by calling Val::downgrade. The GcVal itself is an opaque struct which can't do anything useful. Instead, convert it to a Val by calling its upgrade method.

A GcVal is only useful when you need to store a GameLisp value in an RData. Vals may contain Roots, and storing a Root in an RData would cause a memory leak.


impl GcVal[src]

pub fn upgrade(&self) -> Option<Val>[src]

Attempts to construct a Val based on this GcVal.

Returns None if this GcVal points to a heap-allocated object which has been deallocated by the garbage collector. To prevent this, use glsp::write_barrier and RClassBuilder::trace.

Trait Implementations

impl Clone for GcVal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Erased for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> IntoElement<Slot> for T where
    T: IntoVal

impl<T> IntoVal for T where
    T: StaticMarker, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.