Trait JsGeneric

pub trait JsGeneric: ErasableGeneric<Repr = JsValue> + UpcastFrom<Self> + Upcast<Self> + Upcast<JsValue> + JsCast + 'static

A convenience trait for types that erase to JsValue.

This is a shorthand for ErasableGeneric<Repr = JsValue>, used as a bound on generic parameters that must be representable as JavaScript values.

When to Use

Use JsGeneric as a trait bound when you need a generic type that:

Examples

use wasm_bindgen::JsGeneric;

fn process_js_values<T: JsGeneric>(items: &[T]) {
    // T can be any JS-compatible type
}

Implementors

This trait is automatically implemented for all types that implement ErasableGeneric<Repr = JsValue>, including:

Implementors