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

Implementations

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
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoElement<Slot> for T where
    T: IntoVal
[src]

impl<T> IntoVal for T where
    T: StaticMarker, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.