wasm_bindgen_test/rt/
node.rs1use alloc::string::String;
7use wasm_bindgen::prelude::*;
8
9pub struct Node {}
11
12#[wasm_bindgen]
13extern "C" {
14 type NodeError;
17 #[wasm_bindgen(method, getter, js_class = "Error", structural)]
18 fn stack(this: &NodeError) -> String;
19 #[wasm_bindgen(js_name = __wbgtest_og_console_log)]
20 fn og_console_log(s: &str);
21}
22
23impl Node {
24 pub fn new() -> Node {
26 Node {}
27 }
28}
29
30impl super::Formatter for Node {
31 fn writeln(&self, line: &str) {
32 og_console_log(line);
33 }
34
35 fn stringify_error(&self, err: &JsValue) -> String {
36 NodeError::from(err.clone()).stack()
38 }
39}