Struct Gc

Source
pub struct Gc<T>
where T: GcTrace + ?Sized + 'static,
{ /* private fields */ }
Expand description

! Smart pointer to GCed data. See the module-level documentation for more details.

Implementations§

Source§

impl<T: GcTrace> Gc<T>

Source

pub fn new(data: T) -> Self

Source§

impl<T> Gc<T>
where T: GcTrace + ?Sized + Pointee, T::Metadata: Into<PtrMetadata>, GcBox<T>: Pointee<Metadata = T::Metadata>,

Source

pub fn from_box(data: Box<T>) -> Self

Source§

impl<T> Gc<T>
where T: GcTrace + ?Sized,

Source

pub fn ptr_eq<U>(self_gc: &Gc<T>, other_gc: &Gc<U>) -> bool
where U: GcTrace + ?Sized,

Source

pub fn as_id(self_gc: &Gc<T>) -> usize

Casts the inner pointer to a usize. This is intended for identifying the Gc, and should not be cast back to a pointer.

Source§

impl<T> Gc<T>
where T: GcTrace + ?Sized, PtrMetadata: TryInto<<GcBox<T> as Pointee>::Metadata>,

Source

pub fn weakref(&self) -> GcWeak<T>

Create a weak reference from this GC handle

Source

pub fn mark_trace(self)

Trait Implementations§

Source§

impl<T> AsRef<T> for Gc<T>
where T: GcTrace + ?Sized, PtrMetadata: TryInto<<GcBox<T> as Pointee>::Metadata>,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Borrow<T> for Gc<T>
where T: GcTrace + ?Sized, PtrMetadata: TryInto<<GcBox<T> as Pointee>::Metadata>,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl Callable for Gc<Function>

Source§

fn signature(&self) -> &Signature

Source§

fn raw_call(&self, args: &[Variant]) -> Call

Source§

fn checked_call(&self, args: &[Variant]) -> ExecResult<Call>

Source§

impl Callable for Gc<NativeFunction>

Source§

fn signature(&self) -> &Signature

Source§

fn raw_call(&self, args: &[Variant]) -> Call

Source§

fn checked_call(&self, args: &[Variant]) -> ExecResult<Call>

Source§

impl<T> Clone for Gc<T>
where T: GcTrace + ?Sized,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Gc<T>
where T: GcTrace + ?Sized,

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Deref for Gc<T>
where T: GcTrace + ?Sized, PtrMetadata: TryInto<<GcBox<T> as Pointee>::Metadata>,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<Gc<NamespaceEnv>> for ModuleIdent

Source§

fn from(env: Gc<NamespaceEnv>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Gc<T>> for Gc<dyn GcTrace>
where T: GcTrace,

Source§

fn from(handle: Gc<T>) -> Self

Converts to this type from the input type.
Source§

impl From<Gc<str>> for StringValue

Source§

fn from(gc_str: Gc<str>) -> Self

Converts to this type from the input type.
Source§

impl<T> Hash for Gc<T>
where T: GcTrace + ?Sized,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<F> MetaObject for Gc<F>
where F: GcTrace, Gc<F>: Callable,

Source§

fn type_tag(&self) -> Type

Source§

fn invoke(&self, args: &[Variant]) -> Option<ExecResult<Call>>

Source§

fn cmp_eq(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn fmt_repr(&self) -> ExecResult<StringValue>

Source§

fn type_name(&self) -> ExecResult<StringValue>

Source§

fn as_bool(&self) -> ExecResult<bool>

Source§

fn as_bits(&self) -> Option<ExecResult<IntType>>

Source§

fn as_int(&self) -> Option<ExecResult<IntType>>

Source§

fn as_float(&self) -> Option<ExecResult<FloatType>>

Source§

fn iter_init(&self) -> Option<ExecResult<IterState>>

Source§

fn iter_next(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn iter_get(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn len(&self) -> Option<ExecResult<usize>>

Source§

fn op_neg(&self) -> Option<ExecResult<Variant>>

Source§

fn op_pos(&self) -> Option<ExecResult<Variant>>

Source§

fn op_inv(&self) -> Option<ExecResult<Variant>>

Source§

fn op_mul(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmul(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_div(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rdiv(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_mod(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmod(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_add(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_radd(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_sub(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rsub(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_and(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rand(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_xor(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rxor(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_or(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_ror(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shl(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshl(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shr(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshr(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn cmp_lt(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn cmp_le(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

impl MetaObject for Gc<RuntimeError>

Source§

fn type_tag(&self) -> Type

Source§

fn fmt_repr(&self) -> ExecResult<StringValue>

Source§

fn type_name(&self) -> ExecResult<StringValue>

Source§

fn as_bool(&self) -> ExecResult<bool>

Source§

fn as_bits(&self) -> Option<ExecResult<IntType>>

Source§

fn as_int(&self) -> Option<ExecResult<IntType>>

Source§

fn as_float(&self) -> Option<ExecResult<FloatType>>

Source§

fn iter_init(&self) -> Option<ExecResult<IterState>>

Source§

fn iter_next(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn iter_get(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn len(&self) -> Option<ExecResult<usize>>

Source§

fn invoke(&self, args: &[Variant]) -> Option<ExecResult<Call>>

Source§

fn op_neg(&self) -> Option<ExecResult<Variant>>

Source§

fn op_pos(&self) -> Option<ExecResult<Variant>>

Source§

fn op_inv(&self) -> Option<ExecResult<Variant>>

Source§

fn op_mul(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmul(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_div(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rdiv(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_mod(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmod(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_add(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_radd(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_sub(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rsub(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_and(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rand(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_xor(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rxor(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_or(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_ror(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shl(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshl(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shr(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshr(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn cmp_eq(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn cmp_lt(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn cmp_le(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

impl MetaObject for Gc<dyn UserIterator>

Source§

fn type_tag(&self) -> Type

Source§

fn fmt_repr(&self) -> ExecResult<StringValue>

Source§

fn cmp_eq(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn iter_get(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn iter_next(&self, state: &Variant) -> Option<ExecResult<Variant>>

Source§

fn iter_init(&self) -> Option<ExecResult<IterState>>

Source§

fn type_name(&self) -> ExecResult<StringValue>

Source§

fn as_bool(&self) -> ExecResult<bool>

Source§

fn as_bits(&self) -> Option<ExecResult<IntType>>

Source§

fn as_int(&self) -> Option<ExecResult<IntType>>

Source§

fn as_float(&self) -> Option<ExecResult<FloatType>>

Source§

fn len(&self) -> Option<ExecResult<usize>>

Source§

fn invoke(&self, args: &[Variant]) -> Option<ExecResult<Call>>

Source§

fn op_neg(&self) -> Option<ExecResult<Variant>>

Source§

fn op_pos(&self) -> Option<ExecResult<Variant>>

Source§

fn op_inv(&self) -> Option<ExecResult<Variant>>

Source§

fn op_mul(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmul(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_div(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rdiv(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_mod(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rmod(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_add(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_radd(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_sub(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rsub(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_and(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rand(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_xor(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rxor(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_or(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_ror(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shl(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshl(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_shr(&self, rhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn op_rshr(&self, lhs: &Variant) -> Option<ExecResult<Variant>>

Source§

fn cmp_lt(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

fn cmp_le(&self, other: &Variant) -> Option<ExecResult<bool>>

Source§

impl<T> Copy for Gc<T>
where T: GcTrace + ?Sized,

Auto Trait Implementations§

§

impl<T> Freeze for Gc<T>
where T: ?Sized,

§

impl<T> !RefUnwindSafe for Gc<T>

§

impl<T> !Send for Gc<T>

§

impl<T> !Sync for Gc<T>

§

impl<T> Unpin for Gc<T>
where T: ?Sized,

§

impl<T> !UnwindSafe for Gc<T>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CallHasher for T
where T: Hash + ?Sized,

Source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.