alef 0.115.2

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
#[allow(dead_code)]
fn alef_wasm_err<E: std::fmt::Display + 'static>(e: E) -> wasm_bindgen::JsValue {
    let message = e.to_string();
    let boxed: Box<dyn std::any::Any> = Box::new(e);
{% for rust_path, converter in arms %}
    let boxed = match boxed.downcast::<{{ rust_path }}>() {
        Ok(typed) => return {{ converter }}(*typed),
        Err(other) => other,
    };
{% endfor %}
    drop(boxed);
    wasm_bindgen::JsValue::from_str(&message)
}