1 | /// Marker trait for types that support `#[wasm_bindgen(constructor)]`. |
2 | #[cfg_attr ( |
3 | feature = "msrv" , |
4 | rustversion::attr( |
5 | since(1.78), |
6 | diagnostic::on_unimplemented( |
7 | message = "JavaScript constructors are not supported for `{Self}`" , |
8 | label = "this function cannot be the constructor of `{Self}`" , |
9 | note = "`#[wasm_bindgen(constructor)]` is only supported for `struct`s and cannot be used for `enum`s." , |
10 | note = "Consider removing the `constructor` option and using a regular static method instead." |
11 | ) |
12 | ) |
13 | )] |
14 | pub trait SupportsConstructor {} |
15 | pub struct CheckSupportsConstructor<T: SupportsConstructor>(T); |
16 | |
17 | /// Marker trait for types that support `#[wasm_bindgen(getter)]` or |
18 | /// `#[wasm_bindgen(Setter)]` on instance methods. |
19 | #[cfg_attr ( |
20 | feature = "msrv" , |
21 | rustversion::attr( |
22 | since(1.78), |
23 | diagnostic::on_unimplemented( |
24 | message = "JavaScript instance getters and setters are not supported for `{Self}`" , |
25 | label = "this method cannot be a getter or setter for `{Self}`" , |
26 | note = "`#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s." , |
27 | ) |
28 | ) |
29 | )] |
30 | pub trait SupportsInstanceProperty {} |
31 | pub struct CheckSupportsInstanceProperty<T: SupportsInstanceProperty>(T); |
32 | |
33 | /// Marker trait for types that support `#[wasm_bindgen(getter)]` or |
34 | /// `#[wasm_bindgen(Setter)]` on static methods. |
35 | #[cfg_attr ( |
36 | feature = "msrv" , |
37 | rustversion::attr( |
38 | since(1.78), |
39 | diagnostic::on_unimplemented( |
40 | message = "JavaScript static getters and setters are not supported for `{Self}`" , |
41 | label = "this static function cannot be a static getter or setter on `{Self}`" , |
42 | note = "`#[wasm_bindgen(getter)]` and `#[wasm_bindgen(setter)]` are only supported for `struct`s and cannot be used for `enum`s." , |
43 | ) |
44 | ) |
45 | )] |
46 | pub trait SupportsStaticProperty {} |
47 | pub struct CheckSupportsStaticProperty<T: SupportsStaticProperty>(T); |
48 | |