pub struct GcPtr<T: ?Sized>(/* private fields */);
Expand description
A pointer to a garbage collected value.
It is only safe to access data through a GcPtr
if the value is rooted (stored in a place
where the garbage collector will find it during the mark phase).
Implementations§
source§impl<T: ?Sized> GcPtr<T>
impl<T: ?Sized> GcPtr<T>
sourcepub unsafe fn as_mut(&mut self) -> &mut T
pub unsafe fn as_mut(&mut self) -> &mut T
Unsafe as it is up to the caller to ensure that this pointer is not referenced somewhere else
sourcepub unsafe fn from_raw(ptr: *const T) -> GcPtr<T>
pub unsafe fn from_raw(ptr: *const T) -> GcPtr<T>
Unsafe as ptr
must have been allocted by this garbage collector
pub fn generation(&self) -> Generation
pub fn poly_tag(&self) -> Option<&InternedStr>
pub fn field_map(&self) -> &FnvMap<InternedStr, VmIndex>
pub fn field_names(&self) -> &Arc<[InternedStr]>
pub fn ptr_eq(&self, other: &GcPtr<T>) -> bool
pub unsafe fn unrooted(&self) -> Self
pub fn as_lifetime(&self) -> &()
pub unsafe fn cast<U>(ptr: Self) -> GcPtr<U>
Trait Implementations§
source§impl<T: ?Sized> CloneUnrooted for GcPtr<T>
impl<T: ?Sized> CloneUnrooted for GcPtr<T>
source§impl<T: ?Sized> CopyUnrooted for GcPtr<T>
impl<T: ?Sized> CopyUnrooted for GcPtr<T>
unsafe fn copy_unrooted(&self) -> Self
source§impl<'de, 'gc, T> DeserializeState<'de, DeSeed<'gc>> for GcPtr<T>where
T: Trace + PostDeserialize + 'static + DeserializeState<'de, DeSeed<'gc>>,
impl<'de, 'gc, T> DeserializeState<'de, DeSeed<'gc>> for GcPtr<T>where T: Trace + PostDeserialize + 'static + DeserializeState<'de, DeSeed<'gc>>,
source§fn deserialize_state<D>(
seed: &mut DeSeed<'gc>,
deserializer: D
) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize_state<D>( seed: &mut DeSeed<'gc>, deserializer: D ) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserializes
Self
using seed
and the deserializer
source§impl<'de, 'gc> DeserializeState<'de, DeSeed<'gc>> for GcPtr<ValueStr>
impl<'de, 'gc> DeserializeState<'de, DeSeed<'gc>> for GcPtr<ValueStr>
source§fn deserialize_state<D>(
seed: &mut DeSeed<'gc>,
deserializer: D
) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize_state<D>( seed: &mut DeSeed<'gc>, deserializer: D ) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserializes
Self
using seed
and the deserializer
source§impl<'gc> From<&'gc GcPtr<ClosureData>> for Variants<'gc>
impl<'gc> From<&'gc GcPtr<ClosureData>> for Variants<'gc>
source§fn from(v: &'gc GcPtr<ClosureData>) -> Self
fn from(v: &'gc GcPtr<ClosureData>) -> Self
Converts to this type from the input type.
source§impl<T: ?Sized + Ord> Ord for GcPtr<T>
impl<T: ?Sized + Ord> Ord for GcPtr<T>
source§impl<T: ?Sized + PartialEq> PartialEq<GcPtr<T>> for GcPtr<T>
impl<T: ?Sized + PartialEq> PartialEq<GcPtr<T>> for GcPtr<T>
source§impl<T: ?Sized + PartialOrd> PartialOrd<GcPtr<T>> for GcPtr<T>
impl<T: ?Sized + PartialOrd> PartialOrd<GcPtr<T>> for GcPtr<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T, Seed> SerializeState<Seed> for GcPtr<T>where
T: SerializeState<Seed>,
Seed: AsRef<NodeToId>,
impl<T, Seed> SerializeState<Seed> for GcPtr<T>where T: SerializeState<Seed>, Seed: AsRef<NodeToId>,
source§fn serialize_state<S>(
&self,
serializer: S,
seed: &Seed
) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_state<S>( &self, serializer: S, seed: &Seed ) -> Result<S::Ok, S::Error>where S: Serializer,
Serializes
self
impl<T: ?Sized + Eq> Eq for GcPtr<T>
impl<T: ?Sized + Send + Sync> Send for GcPtr<T>
impl<T: ?Sized + Send + Sync> Sync for GcPtr<T>
Auto Trait Implementations§
impl<T: ?Sized> RefUnwindSafe for GcPtr<T>where T: RefUnwindSafe,
impl<T: ?Sized> Unpin for GcPtr<T>
impl<T: ?Sized> UnwindSafe for GcPtr<T>where T: RefUnwindSafe,
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<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.