Trait Class

Source
pub trait Class: NativeObject + Sized {
    const NAME: &'static str;
    const LENGTH: usize = 0usize;
    const ATTRIBUTES: Attribute = _;

    // Required methods
    fn constructor(
        this: &JsValue,
        args: &[JsValue],
        context: &mut Context,
    ) -> JsResult<Self>;
    fn init(class: &mut ClassBuilder<'_>) -> JsResult<()>;
}
Expand description

Native class.

Required Associated Constants§

Source

const NAME: &'static str

The binding name of the object.

Provided Associated Constants§

Source

const LENGTH: usize = 0usize

The amount of arguments the class constructor takes, default is 0.

Source

const ATTRIBUTES: Attribute = _

The attibutes the class will be binded with, default is writable, enumerable, configurable.

Required Methods§

Source

fn constructor( this: &JsValue, args: &[JsValue], context: &mut Context, ) -> JsResult<Self>

The constructor of the class.

Source

fn init(class: &mut ClassBuilder<'_>) -> JsResult<()>

Initializes the internals and the methods of 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.

Implementors§