Trait neon::types::Finalize

source ·
pub trait Finalize: Sized {
    fn finalize<'a, C: Context<'a>>(self, _: &mut C) { ... }
Expand description

Finalize is executed on the main JavaScript thread and executed immediately before garbage collection. Values contained by a JsBox must implement Finalize.


Finalize provides a default implementation that does not perform any finalization.

struct Point(f64, f64);

impl Finalize for Point {}

A finalize method may be specified for performing clean-up operations before dropping the contained value.

struct Point(f64, f64);

impl Finalize for Point {
    fn finalize<'a, C: Context<'a>>(self, cx: &mut C) {
        let global =;
        let emit: Handle<JsFunction> = global
            .get(cx, "emit")

        let args = vec![
        ];, global, args).unwrap();

Provided Methods§

Implementations on Foreign Types§