pub trait Class: ClassInternal {
// Required methods
fn name() -> String;
fn constructor<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction>;
}Available on crate feature
napi-6 only.Expand description
A trait defining a Neon class.
This should not be implemented directly. Instead, use the #[neon::class]
attribute macro to define a class, which will automatically implement this trait.
Required Methods§
Sourcefn constructor<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction>
fn constructor<'cx>(cx: &mut Cx<'cx>) -> JsResult<'cx, JsFunction>
The constructor function for the class.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.