MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / __coerce_unchecked

Method __coerce_unchecked

aiscript-arena/src/unsize.rs:82–94  ·  view source on GitHub ↗
(self, coerce: F)

Source from the content-addressed store, hash-verified

80
81 #[inline(always)]
82 unsafe fn __coerce_unchecked<F>(self, coerce: F) -> Gc<'gc, U>
83 where
84 F: FnOnce(*mut T) -> *mut U,
85 {
86 unsafe {
87 let ptr = self.ptr.as_ptr() as *mut T;
88 let ptr = NonNull::new_unchecked(coerce(ptr) as *mut GcBoxInner<U>);
89 Gc {
90 ptr,
91 _invariant: PhantomData,
92 }
93 }
94 }
95}
96
97unsafe impl<'gc, T, U: ?Sized> __CoercePtrInternal<GcWeak<'gc, U>> for GcWeak<'gc, T> {

Callers

nothing calls this directly

Calls 1

as_ptrMethod · 0.45

Tested by

no test coverage detected