web_sys/features/
gen_GpuRequestAdapterOptions.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[cfg(web_sys_unstable_apis)]
6#[wasm_bindgen]
7extern "C" {
8    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPURequestAdapterOptions)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `GpuRequestAdapterOptions` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
13    #[doc = ""]
14    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type GpuRequestAdapterOptions;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `featureLevel` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
21    #[doc = ""]
22    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
23    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
24    #[wasm_bindgen(method, getter = "featureLevel")]
25    pub fn get_feature_level(this: &GpuRequestAdapterOptions) -> Option<::alloc::string::String>;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `featureLevel` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
30    #[doc = ""]
31    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
32    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
33    #[wasm_bindgen(method, setter = "featureLevel")]
34    pub fn set_feature_level(this: &GpuRequestAdapterOptions, val: &str);
35    #[cfg(web_sys_unstable_apis)]
36    #[doc = "Get the `forceFallbackAdapter` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
39    #[doc = ""]
40    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
41    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
42    #[wasm_bindgen(method, getter = "forceFallbackAdapter")]
43    pub fn get_force_fallback_adapter(this: &GpuRequestAdapterOptions) -> Option<bool>;
44    #[cfg(web_sys_unstable_apis)]
45    #[doc = "Change the `forceFallbackAdapter` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
48    #[doc = ""]
49    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
51    #[wasm_bindgen(method, setter = "forceFallbackAdapter")]
52    pub fn set_force_fallback_adapter(this: &GpuRequestAdapterOptions, val: bool);
53    #[cfg(web_sys_unstable_apis)]
54    #[cfg(feature = "GpuPowerPreference")]
55    #[doc = "Get the `powerPreference` field of this object."]
56    #[doc = ""]
57    #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"]
58    #[doc = ""]
59    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
60    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
61    #[wasm_bindgen(method, getter = "powerPreference")]
62    pub fn get_power_preference(this: &GpuRequestAdapterOptions) -> Option<GpuPowerPreference>;
63    #[cfg(web_sys_unstable_apis)]
64    #[cfg(feature = "GpuPowerPreference")]
65    #[doc = "Change the `powerPreference` field of this object."]
66    #[doc = ""]
67    #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"]
68    #[doc = ""]
69    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
70    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
71    #[wasm_bindgen(method, setter = "powerPreference")]
72    pub fn set_power_preference(this: &GpuRequestAdapterOptions, val: GpuPowerPreference);
73    #[cfg(web_sys_unstable_apis)]
74    #[doc = "Get the `xrCompatible` field of this object."]
75    #[doc = ""]
76    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
77    #[doc = ""]
78    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
79    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
80    #[wasm_bindgen(method, getter = "xrCompatible")]
81    pub fn get_xr_compatible(this: &GpuRequestAdapterOptions) -> Option<bool>;
82    #[cfg(web_sys_unstable_apis)]
83    #[doc = "Change the `xrCompatible` field of this object."]
84    #[doc = ""]
85    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
86    #[doc = ""]
87    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
88    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
89    #[wasm_bindgen(method, setter = "xrCompatible")]
90    pub fn set_xr_compatible(this: &GpuRequestAdapterOptions, val: bool);
91}
92#[cfg(web_sys_unstable_apis)]
93impl GpuRequestAdapterOptions {
94    #[doc = "Construct a new `GpuRequestAdapterOptions`."]
95    #[doc = ""]
96    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
97    #[doc = ""]
98    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
99    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
100    pub fn new() -> Self {
101        #[allow(unused_mut)]
102        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
103        ret
104    }
105    #[cfg(web_sys_unstable_apis)]
106    #[deprecated = "Use `set_feature_level()` instead."]
107    pub fn feature_level(&mut self, val: &str) -> &mut Self {
108        self.set_feature_level(val);
109        self
110    }
111    #[cfg(web_sys_unstable_apis)]
112    #[deprecated = "Use `set_force_fallback_adapter()` instead."]
113    pub fn force_fallback_adapter(&mut self, val: bool) -> &mut Self {
114        self.set_force_fallback_adapter(val);
115        self
116    }
117    #[cfg(web_sys_unstable_apis)]
118    #[cfg(feature = "GpuPowerPreference")]
119    #[deprecated = "Use `set_power_preference()` instead."]
120    pub fn power_preference(&mut self, val: GpuPowerPreference) -> &mut Self {
121        self.set_power_preference(val);
122        self
123    }
124    #[cfg(web_sys_unstable_apis)]
125    #[deprecated = "Use `set_xr_compatible()` instead."]
126    pub fn xr_compatible(&mut self, val: bool) -> &mut Self {
127        self.set_xr_compatible(val);
128        self
129    }
130}
131#[cfg(web_sys_unstable_apis)]
132impl Default for GpuRequestAdapterOptions {
133    fn default() -> Self {
134        Self::new()
135    }
136}