pub trait JsClass<'js>:
Trace<'js>
+ JsLifetime<'js>
+ Sized {
type Mutable: Mutability;
const NAME: &'static str;
const CALLABLE: bool = false;
// Required method
fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>;
// Provided methods
fn prototype(ctx: &Ctx<'js>) -> Result<Option<Object<'js>>> { ... }
fn call<'a>(
this: &JsCell<'js, Self>,
params: Params<'a, 'js>,
) -> Result<Value<'js>> { ... }
}
Expand description
The trait which allows Rust types to be used from JavaScript.
Required Associated Constants§
Provided Associated Constants§
Required Associated Types§
Sourcetype Mutable: Mutability
type Mutable: Mutability
Required Methods§
Sourcefn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
Returns a predefined constructor for this specific class type if there is one.
Provided Methods§
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.