node_sys/interface/
assertion_error_options.rs

1use js_sys::JsString;
2use wasm_bindgen::prelude::*;
3
4#[allow(dead_code)]
5#[wasm_bindgen]
6pub struct AssertionErrorOptions {
7    message: Option<JsString>,
8    actual: JsValue,
9    expected: JsValue,
10    operator: JsString,
11}
12
13#[wasm_bindgen]
14impl AssertionErrorOptions {
15    #[wasm_bindgen(constructor)]
16    pub fn new(
17        message: Option<JsString>,
18        actual: JsValue,
19        expected: JsValue,
20        operator: JsString,
21    ) -> AssertionErrorOptions {
22        AssertionErrorOptions {
23            message,
24            actual,
25            expected,
26            operator,
27        }
28    }
29
30    /// If provided, the error message is set to this value.
31    #[wasm_bindgen(getter)]
32    pub fn message(&self) -> Option<JsString> {
33        self.message.clone()
34    }
35
36    #[wasm_bindgen(setter)]
37    pub fn set_message(&mut self, value: Option<JsString>) {
38        self.message = value;
39    }
40
41    /// The actual property on the error instance.
42    #[wasm_bindgen(getter)]
43    pub fn actual(&self) -> JsValue {
44        self.actual.clone()
45    }
46
47    #[wasm_bindgen(setter)]
48    pub fn set_actual(&mut self, value: JsValue) {
49        self.actual = value;
50    }
51
52    /// The expected property on the error instance.
53    #[wasm_bindgen(getter)]
54    pub fn expected(&self) -> JsValue {
55        self.expected.clone()
56    }
57
58    #[wasm_bindgen(setter)]
59    pub fn set_expected(&mut self, value: JsValue) {
60        self.expected = value;
61    }
62
63    /// The operator property on the error instance.
64    #[wasm_bindgen(getter)]
65    pub fn operator(&self) -> JsString {
66        self.operator.clone()
67    }
68
69    #[wasm_bindgen(setter)]
70    pub fn set_operator(&mut self, value: JsString) {
71        self.operator = value;
72    }
73}