Debian Codegraph @

.cargo/vendor/wasm-bindgen/guide/src/reference/attributes/on-js-imports/no_deref.md

raw
1 # `no_deref`
2
3 The `no_deref` attribute can be used to say that no `Deref` impl should be
4 generated for an imported type. If this attribute is not present, a `Deref` impl
5 will be generated with a `Target` of the type's first `extends` attribute, or
6 `Target = JsValue` if there are no `extends` attributes.
7
8 ```rust
9 #[wasm_bindgen]
10 extern "C" {
11 type Foo;
12
13 #[wasm_bindgen(method)]
14 fn baz(this: &Foo)
15
16 #[wasm_bindgen(extends = Foo, no_deref)]
17 type Bar;
18 }
19
20 fn do_stuff(bar: &Bar) {
21 bar.baz() // Does not compile
22 }
23
24 ```