[][src]Struct pgc::Rooted

pub struct Rooted<T: GcObject + 'static> { /* fields omitted */ }

An structure to hold root object alive until end of it's live. Internally this structure uses reference counting.

use ngc::*;

{
    let object = Rooted::new(42); // is_root(object) = true

} // drop `Rooted` and unroot allocated object
gc_collect();

Methods

impl<T: GcObject + 'static> Rooted<T>[src]

pub fn new(val: T) -> Self[src]

Construct new rooted object.

pub fn with(x: Gc<T>) -> Self[src]

pub fn inner(&self) -> Gc<T>[src]

pub fn get_mut(&self) -> &mut T[src]

pub fn get(&self) -> &T[src]

Trait Implementations

impl<T: 'static + GcObject> Drop for Rooted<T>[src]

impl<T: 'static + GcObject> Clone for Rooted<T>[src]

impl<T: GcObject + 'static> From<Rooted<T>> for Gc<T>[src]

Auto Trait Implementations

impl<T> Send for Rooted<T> where
    T: Sync

impl<T> Unpin for Rooted<T>

impl<T> Sync for Rooted<T> where
    T: Sync

impl<T> UnwindSafe for Rooted<T> where
    T: RefUnwindSafe

impl<T> RefUnwindSafe for Rooted<T> where
    T: RefUnwindSafe

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,