fn finalizer<U: Finalize + 'static>(env: raw::Env, data: BoxAny) {
            let data = *data.downcast::<U>().unwrap();
            let env = unsafe { std::mem::transmute(env) };

            FinalizeContext::with(env, move |mut cx| data.finalize(&mut cx));
        }
// This function will execute immediately before the `JsBox` is garbage collected.
// It unwraps the `napi_external`, downcasts the `BoxAny` and moves the type
// out of the `Box`. Lastly, it calls the trait method `Finalize::fianlize` of the
// contained value `T`.
This function will execute immediately before the `JsBox` is garbage collected.
This function will execute immediately before the ` JsBox ` is garbage collected .
fn finalizer<U: Finalize + 'static>(env: raw::Env, data: BoxAny) {
            let data = *data.downcast::<U>().unwrap();
            let env = unsafe { std::mem::transmute(env) };
            FinalizeContext::with(env, move |mut cx| data.finalize(&mut cx));
        }
fn finalizer < U : Finalize + ' static > ( env : raw :: Env , data : BoxAny ) { let data = * data . downcast :: < U > ( ) . unwrap ( ) ; let env = unsafe { std :: mem :: transmute ( env ) } ; FinalizeContext :: with ( env , move | mut cx | data . finalize ( & mut cx ) ) ; }
This function will execute immediately before the `JsBox` is garbage collected.
This function will execute immediately before the ` JsBox ` is garbage collected .
env
raw::Env
data
BoxAny