Trait zerogc::TrustedDrop
source · [−]pub unsafe trait TrustedDrop: Trace { }
Expand description
Indicates that a type’s Drop implementation is trusted not to resurrect any garbage collected object.
This is a requirement for a type to be allocated in GcSimpleAlloc,
and also for a type to be GcSafe
.
Unlike java finalizers, these trusted destructors avoids a second pass to check for resurrected objects. This is important giving the frequency of destructors when interoperating with native code.
The collector is of course free to implement support java-style finalizers in addition to supporting these “trusted” destructors.
Safety
To implement this trait, the type’s destructor must never reference garbage collected pointers that may already be dead and must never resurrect dead objects. The garbage collector may have already freed the other objects before calling this type’s drop function.
Implementations on Foreign Types
impl TrustedDrop for i8
impl TrustedDrop for i16
impl TrustedDrop for i32
impl TrustedDrop for i64
impl TrustedDrop for isize
impl TrustedDrop for u8
impl TrustedDrop for u16
impl TrustedDrop for u32
impl TrustedDrop for u64
impl TrustedDrop for usize
impl TrustedDrop for f32
impl TrustedDrop for f64
impl TrustedDrop for bool
impl TrustedDrop for char
impl TrustedDrop for &'static str
impl<T> TrustedDrop for PhantomData<T>
impl TrustedDrop for ()
impl<I> TrustedDrop for (I,) where
I: TrustedDrop,
impl<H, I> TrustedDrop for (H, I) where
H: TrustedDrop,
I: TrustedDrop,
impl<G, H, I> TrustedDrop for (G, H, I) where
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<F, G, H, I> TrustedDrop for (F, G, H, I) where
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<E, F, G, H, I> TrustedDrop for (E, F, G, H, I) where
E: TrustedDrop,
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<D, E, F, G, H, I> TrustedDrop for (D, E, F, G, H, I) where
D: TrustedDrop,
E: TrustedDrop,
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<C, D, E, F, G, H, I> TrustedDrop for (C, D, E, F, G, H, I) where
C: TrustedDrop,
D: TrustedDrop,
E: TrustedDrop,
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<B, C, D, E, F, G, H, I> TrustedDrop for (B, C, D, E, F, G, H, I) where
B: TrustedDrop,
C: TrustedDrop,
D: TrustedDrop,
E: TrustedDrop,
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<A, B, C, D, E, F, G, H, I> TrustedDrop for (A, B, C, D, E, F, G, H, I) where
A: TrustedDrop,
B: TrustedDrop,
C: TrustedDrop,
D: TrustedDrop,
E: TrustedDrop,
F: TrustedDrop,
G: TrustedDrop,
H: TrustedDrop,
I: TrustedDrop,
impl<T, const SIZE: usize> TrustedDrop for [T; SIZE] where
T: TrustedDrop,
impl<'a, T: ?Sized + 'a> TrustedDrop for &'a T where
T: TraceImmutable,
impl<T: NullTrace> TrustedDrop for Cell<T> where
T: TrustedDrop,
impl<T: ImplicitWriteBarrier> TrustedDrop for RefCell<T> where
T: TrustedDrop,
impl<'a, T: 'a> TrustedDrop for &'a mut T where
T: TrustedDrop,
impl<T> TrustedDrop for [T] where
T: TrustedDrop,
impl<T> TrustedDrop for Option<T> where
T: TrustedDrop,
impl<T> TrustedDrop for Wrapping<T> where
T: TrustedDrop,
impl<T> TrustedDrop for Vec<T> where
T: TrustedDrop,
impl<T> TrustedDrop for Box<T> where
T: TrustedDrop,
impl<T: TraceImmutable> TrustedDrop for Rc<T> where
T: TrustedDrop,
impl<T: TraceImmutable> TrustedDrop for Arc<T> where
T: TrustedDrop,
impl TrustedDrop for String
impl<K: TraceImmutable, V, S: 'static> TrustedDrop for HashMap<K, V, S> where
K: TrustedDrop,
V: TrustedDrop,
S: 'static,
impl<T: TraceImmutable, S: 'static> TrustedDrop for HashSet<T, S> where
T: TrustedDrop,
S: 'static,
Implementors
impl TrustedDrop for EpsilonCollectorId where
Self: 'static,
impl<'gc, Id: CollectorId> TrustedDrop for GcString<'gc, Id>
impl<'gc, T: GcSafe<'gc, EpsilonCollectorId>> TrustedDrop for EpsilonRawVec<'gc, T> where
T: TrustedDrop,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for GcArray<'gc, T, Id> where
T: TrustedDrop,
Id: TrustedDrop,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for GcVecCell<'gc, T, Id> where
T: TrustedDrop,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for Unsupported<'gc, T, Id> where
T: TrustedDrop,
Id: TrustedDrop,
impl<'gc, T: GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for GcVec<'gc, T, Id> where
T: TrustedDrop,
Id: TrustedDrop,
impl<'gc, T: ?Sized + GcSafe<'gc, Id>, Id: CollectorId> TrustedDrop for Gc<'gc, T, Id>
Double-indirection is completely safe