pub(crate) struct Gc<T> {
ptr: *const u8,
_data: PhantomData<T>,
}
Expand description
This type has two meanings, it is both a value that is tagged as well as something that is managed by the GC. It is intended to be pointer sized, and have a lifetime tied to the context which manages garbage collections. A Gc can be reinterpreted as any type that shares the same tag.
Fields§
§ptr: *const u8
§_data: PhantomData<T>
Implementations§
Source§impl<T> Gc<T>
impl<T> Gc<T>
const fn new(ptr: *const u8) -> Self
unsafe fn from_ptr<U>(ptr: *const U, tag: Tag) -> Self
fn untag_ptr(self) -> (*const u8, Tag)
fn get_tag(self) -> Tag
pub(crate) fn into_raw(self) -> RawObj
pub(in core) fn into_ptr( self, ) -> *const u8
pub(crate) unsafe fn from_raw(raw: RawObj) -> Self
pub(crate) unsafe fn from_raw_ptr(raw: *mut u8) -> Self
pub(crate) fn ptr_eq<U>(self, other: Gc<U>) -> bool
pub(crate) fn as_obj(&self) -> Gc<ObjectType<'_>>
Source§impl<'ob, T> Gc<T>where
T: 'ob,
impl<'ob, T> Gc<T>where
T: 'ob,
pub(crate) fn as_obj_copy(self) -> Gc<ObjectType<'ob>>
Source§impl<T> Gc<T>
impl<T> Gc<T>
Sourcepub(crate) fn untag(self) -> T
pub(crate) fn untag(self) -> T
A non-trait version of Untag::untag_erased. This is useful when we don’t want to import the trait all over the place. The only time we need to import the trait is in generic code.
Source§impl<'ob> Gc<ObjectType<'ob>>
impl<'ob> Gc<ObjectType<'ob>>
pub(crate) fn try_from_option<T, E>( value: Gc<ObjectType<'ob>>, ) -> Result<Option<T>, E>
pub(crate) fn is_nil(self) -> bool
Source§impl<'ob> Gc<ObjectType<'ob>>
impl<'ob> Gc<ObjectType<'ob>>
Sourcepub(crate) fn as_cons_pair(
self,
) -> Result<(Symbol<'ob>, ObjectType<'ob>), TypeError>
pub(crate) fn as_cons_pair( self, ) -> Result<(Symbol<'ob>, ObjectType<'ob>), TypeError>
Convience method to easily match against cons cells that are the start of a list of values.
Source§impl<'ob> Gc<FunctionType<'ob>>
impl<'ob> Gc<FunctionType<'ob>>
Sourcepub(crate) fn as_cons_pair(
self,
) -> Result<(Symbol<'ob>, FunctionType<'ob>), TypeError>
pub(crate) fn as_cons_pair( self, ) -> Result<(Symbol<'ob>, FunctionType<'ob>), TypeError>
Convience method to easily match against cons cells that are the start of a list of values.
Source§impl Gc<NumberType<'_>>
impl Gc<NumberType<'_>>
pub(crate) fn val(self) -> NumberValue
Trait Implementations§
Source§impl Default for Gc<ObjectType<'_>>
impl Default for Gc<ObjectType<'_>>
Source§impl<'ob> IntoIterator for Gc<ListType<'ob>>
impl<'ob> IntoIterator for Gc<ListType<'ob>>
Source§impl<T> IntoObject for Gc<T>
impl<T> IntoObject for Gc<T>
Source§impl Markable for Gc<FunctionType<'_>>
impl Markable for Gc<FunctionType<'_>>
Source§impl Markable for Gc<ObjectType<'_>>
impl Markable for Gc<ObjectType<'_>>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob ByteString
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob ByteString
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob LispHashTable
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob LispHashTable
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob LispString
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob LispString
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob ByteString>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob ByteString>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispBuffer>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispBuffer>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispHashTable>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispHashTable>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispString>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<&'ob LispString>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<FunctionType<'ob>>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<FunctionType<'ob>>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<NumberType<'ob>>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Gc<NumberType<'ob>>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob ByteString>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob ByteString>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob LispHashTable>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob LispHashTable>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob LispString>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<&'ob LispString>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<Gc<NumberType<'ob>>>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Option<Gc<NumberType<'ob>>>
Source§impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for StringOrSymbol<'ob>
impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for StringOrSymbol<'ob>
Source§impl<'new, T: WithLifetime<'new>> WithLifetime<'new> for Gc<T>
impl<'new, T: WithLifetime<'new>> WithLifetime<'new> for Gc<T>
type Out = Gc<<T as WithLifetime<'new>>::Out>
unsafe fn with_lifetime(self) -> Self::Out
Source§impl<'ob> From<&'ob ByteString> for Gc<ObjectType<'ob>>
impl<'ob> From<&'ob ByteString> for Gc<ObjectType<'ob>>
Source§fn from(x: &'ob ByteString) -> Self
fn from(x: &'ob ByteString) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<&'ob LispBuffer> for Gc<ObjectType<'ob>>
impl<'ob> From<&'ob LispBuffer> for Gc<ObjectType<'ob>>
Source§fn from(x: &'ob LispBuffer) -> Self
fn from(x: &'ob LispBuffer) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<&'ob LispHashTable> for Gc<ObjectType<'ob>>
impl<'ob> From<&'ob LispHashTable> for Gc<ObjectType<'ob>>
Source§fn from(x: &'ob LispHashTable) -> Self
fn from(x: &'ob LispHashTable) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<&'ob LispString> for Gc<ObjectType<'ob>>
impl<'ob> From<&'ob LispString> for Gc<ObjectType<'ob>>
Source§fn from(x: &'ob LispString) -> Self
fn from(x: &'ob LispString) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<FunctionType<'ob>> for Gc<ObjectType<'ob>>
impl<'ob> From<FunctionType<'ob>> for Gc<ObjectType<'ob>>
Source§fn from(x: FunctionType<'ob>) -> Self
fn from(x: FunctionType<'ob>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<&'ob ByteString>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<&'ob ByteString>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<&'ob ByteString>) -> Self
fn from(x: Gc<&'ob ByteString>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<&'ob LispBuffer>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<&'ob LispBuffer>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<&'ob LispBuffer>) -> Self
fn from(x: Gc<&'ob LispBuffer>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<&'ob LispHashTable>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<&'ob LispHashTable>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<&'ob LispHashTable>) -> Self
fn from(x: Gc<&'ob LispHashTable>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<&'ob LispString>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<&'ob LispString>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<&'ob LispString>) -> Self
fn from(x: Gc<&'ob LispString>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<FunctionType<'ob>>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<FunctionType<'ob>>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<FunctionType<'ob>>) -> Self
fn from(x: Gc<FunctionType<'ob>>) -> Self
Converts to this type from the input type.
Source§impl<'ob> From<Gc<NumberType<'ob>>> for Gc<ObjectType<'ob>>
impl<'ob> From<Gc<NumberType<'ob>>> for Gc<ObjectType<'ob>>
Source§fn from(x: Gc<NumberType<'ob>>) -> Self
fn from(x: Gc<NumberType<'ob>>) -> Self
Converts to this type from the input type.
Source§impl From<Gc<ObjectType<'_>>> for ()
impl From<Gc<ObjectType<'_>>> for ()
Source§fn from(_: Gc<ObjectType<'_>>)
fn from(_: Gc<ObjectType<'_>>)
Converts to this type from the input type.
Source§impl<'ob> From<NumberType<'ob>> for Gc<ObjectType<'ob>>
impl<'ob> From<NumberType<'ob>> for Gc<ObjectType<'ob>>
Source§fn from(x: NumberType<'ob>) -> Self
fn from(x: NumberType<'ob>) -> Self
Converts to this type from the input type.
impl<T: Copy> Copy for Gc<T>
impl<T> Eq for Gc<T>
impl<T> GcPtr for Gc<T>
impl<T> Send for Gc<T>
Auto Trait Implementations§
impl<T> Freeze for Gc<T>
impl<T> RefUnwindSafe for Gc<T>where
T: RefUnwindSafe,
impl<T> !Sync for Gc<T>
impl<T> Unpin for Gc<T>where
T: Unpin,
impl<T> UnwindSafe for Gc<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.