maxcountryman_web_sys/features/
gen_GpuRequestAdapterOptions.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[cfg(web_sys_unstable_apis)]
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPURequestAdapterOptions)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `GpuRequestAdapterOptions` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
12    #[doc = ""]
13    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
14    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
15    pub type GpuRequestAdapterOptions;
16}
17#[cfg(web_sys_unstable_apis)]
18impl GpuRequestAdapterOptions {
19    #[doc = "Construct a new `GpuRequestAdapterOptions`."]
20    #[doc = ""]
21    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
22    #[doc = ""]
23    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
24    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
25    pub fn new() -> Self {
26        #[allow(unused_mut)]
27        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
28        ret
29    }
30    #[cfg(web_sys_unstable_apis)]
31    #[doc = "Change the `forceSoftware` field of this object."]
32    #[doc = ""]
33    #[doc = "*This API requires the following crate features to be activated: `GpuRequestAdapterOptions`*"]
34    #[doc = ""]
35    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
36    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
37    pub fn force_software(&mut self, val: bool) -> &mut Self {
38        use wasm_bindgen::JsValue;
39        let r = ::js_sys::Reflect::set(
40            self.as_ref(),
41            &JsValue::from("forceSoftware"),
42            &JsValue::from(val),
43        );
44        debug_assert!(
45            r.is_ok(),
46            "setting properties should never fail on our dictionary objects"
47        );
48        let _ = r;
49        self
50    }
51    #[cfg(web_sys_unstable_apis)]
52    #[cfg(feature = "GpuPowerPreference")]
53    #[doc = "Change the `powerPreference` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `GpuPowerPreference`, `GpuRequestAdapterOptions`*"]
56    #[doc = ""]
57    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
58    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
59    pub fn power_preference(&mut self, val: GpuPowerPreference) -> &mut Self {
60        use wasm_bindgen::JsValue;
61        let r = ::js_sys::Reflect::set(
62            self.as_ref(),
63            &JsValue::from("powerPreference"),
64            &JsValue::from(val),
65        );
66        debug_assert!(
67            r.is_ok(),
68            "setting properties should never fail on our dictionary objects"
69        );
70        let _ = r;
71        self
72    }
73}
74#[cfg(web_sys_unstable_apis)]
75impl Default for GpuRequestAdapterOptions {
76    fn default() -> Self {
77        Self::new()
78    }
79}