Skip to main content

Class

Trait Class 

Source
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§

Source

fn name() -> String

The class name.

Source

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".

Implementors§