fn take_shared_box(inner: ptr::NonNull<SharedBox<AnyObj>>) -> Self {
        return Self {
            data: inner.as_ptr() as *const (),
            drop_fn: drop_fn_impl,
        };

        unsafe fn drop_fn_impl(data: *const ()) {
            let shared = data as *mut () as *mut SharedBox<AnyObj>;

            // Mark the shared box for exclusive access.
            let _ = ManuallyDrop::new(
                (*shared)
                    .access
                    .take(AccessKind::Any)
                    .expect("raw pointers must not be shared"),
            );

            // Free the inner `Any` structure, and since we have marked the
            // Shared as taken, this will prevent anyone else from doing it.
            drop(ptr::read((*shared).data.get()));

            SharedBox::dec(shared);
        }
    }
/// Construct a raw drop that will take the shared box as it's being
/// dropped.
///
/// # Safety
///
/// Should only be constructed over a pointer that is lively owned.
Construct a raw drop that will take the shared box as it's being
dropped.
Construct a raw drop that will take the shared box as it ' s being dropped .
fn take_shared_box(inner: ptr::NonNull<SharedBox<AnyObj>>) -> Self {
        return Self {
            data: inner.as_ptr() as *const (),
            drop_fn: drop_fn_impl,
        };
        unsafe fn drop_fn_impl(data: *const ()) {
            let shared = data as *mut () as *mut SharedBox<AnyObj>;
            // Mark the shared box for exclusive access.
            let _ = ManuallyDrop::new(
                (*shared)
                    .access
                    .take(AccessKind::Any)
                    .expect("raw pointers must not be shared"),
            );
            // Free the inner `Any` structure, and since we have marked the
            // Shared as taken, this will prevent anyone else from doing it.
            drop(ptr::read((*shared).data.get()));
            SharedBox::dec(shared);
        }
    }
fn take_shared_box ( inner : ptr :: NonNull < SharedBox < AnyObj > > ) -> Self { return Self { data : inner . as_ptr ( ) as * const ( ) , drop_fn : drop_fn_impl , } ; unsafe fn drop_fn_impl ( data : * const ( ) ) { let shared = data as * mut ( ) as * mut SharedBox < AnyObj > ; // Mark the shared box for exclusive access. let _ = ManuallyDrop :: new ( ( * shared ) . access . take ( AccessKind :: Any ) . expect ( " " ) , ) ; // Free the inner `Any` structure, and since we have marked the // Shared as taken, this will prevent anyone else from doing it. drop ( ptr :: read ( ( * shared ) . data . get ( ) ) ) ; SharedBox :: dec ( shared ) ; } }
Construct a raw drop that will take the shared box as it's being
dropped.
Construct a raw drop that will take the shared box as it ' s being dropped .
inner
ptr::NonNull<SharedBox<AnyObj>>
inner
ptr::NonNull<SharedBox<AnyObj>>
safety
Should only be constructed over a pointer that is lively owned.
Should only be constructed over a pointer that is lively owned .