#![allow(dead_code)]
use rquickjs::{
class::{JsClass, Readable, Trace, Tracer},
Class, Context, JsLifetime, Null, Runtime,
};
use std::sync::Mutex;
static VALIDATE: Mutex<(bool, bool, bool)> = Mutex::new((false, false, false));
pub struct A;
impl<'js> Trace<'js> for A {
fn trace(&self, _tracer: Tracer<'_, 'js>) {
VALIDATE.lock().unwrap().0 = true;
}
}
pub struct B;
impl<'js> Trace<'js> for B {
fn trace(&self, _tracer: Tracer<'_, 'js>) {
VALIDATE.lock().unwrap().1 = true;
}
}
pub struct C;
impl<'js> Trace<'js> for C {
fn trace(&self, _tracer: Tracer<'_, 'js>) {
VALIDATE.lock().unwrap().2 = true;
}
}
#[derive(Trace, JsLifetime)]
pub struct TraceStruct {
a: A,
#[qjs(skip_trace)]
b: B,
c: C,
}
impl<'js> JsClass<'js> for TraceStruct {
const NAME: &'static str = "TraceStruct";
type Mutable = Readable;
fn prototype(_ctx: &rquickjs::Ctx<'js>) -> rquickjs::Result