web_sys/features/
gen_GpuCanvasConfiguration.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 = GPUCanvasConfiguration)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `GpuCanvasConfiguration` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
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 GpuCanvasConfiguration;
17    #[cfg(web_sys_unstable_apis)]
18    #[cfg(feature = "GpuCanvasAlphaMode")]
19    #[doc = "Get the `alphaMode` field of this object."]
20    #[doc = ""]
21    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"]
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    #[wasm_bindgen(method, getter = "alphaMode")]
26    pub fn get_alpha_mode(this: &GpuCanvasConfiguration) -> Option<GpuCanvasAlphaMode>;
27    #[cfg(web_sys_unstable_apis)]
28    #[cfg(feature = "GpuCanvasAlphaMode")]
29    #[doc = "Change the `alphaMode` field of this object."]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasAlphaMode`, `GpuCanvasConfiguration`*"]
32    #[doc = ""]
33    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
34    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
35    #[wasm_bindgen(method, setter = "alphaMode")]
36    pub fn set_alpha_mode(this: &GpuCanvasConfiguration, val: GpuCanvasAlphaMode);
37    #[cfg(web_sys_unstable_apis)]
38    #[cfg(feature = "GpuDevice")]
39    #[doc = "Get the `device` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"]
42    #[doc = ""]
43    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
44    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
45    #[wasm_bindgen(method, getter = "device")]
46    pub fn get_device(this: &GpuCanvasConfiguration) -> GpuDevice;
47    #[cfg(web_sys_unstable_apis)]
48    #[cfg(feature = "GpuDevice")]
49    #[doc = "Change the `device` field of this object."]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"]
52    #[doc = ""]
53    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
54    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
55    #[wasm_bindgen(method, setter = "device")]
56    pub fn set_device(this: &GpuCanvasConfiguration, val: &GpuDevice);
57    #[cfg(web_sys_unstable_apis)]
58    #[cfg(feature = "GpuTextureFormat")]
59    #[doc = "Get the `format` field of this object."]
60    #[doc = ""]
61    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
62    #[doc = ""]
63    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
64    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
65    #[wasm_bindgen(method, getter = "format")]
66    pub fn get_format(this: &GpuCanvasConfiguration) -> GpuTextureFormat;
67    #[cfg(web_sys_unstable_apis)]
68    #[cfg(feature = "GpuTextureFormat")]
69    #[doc = "Change the `format` field of this object."]
70    #[doc = ""]
71    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
72    #[doc = ""]
73    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
74    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
75    #[wasm_bindgen(method, setter = "format")]
76    pub fn set_format(this: &GpuCanvasConfiguration, val: GpuTextureFormat);
77    #[cfg(web_sys_unstable_apis)]
78    #[cfg(feature = "GpuCanvasToneMapping")]
79    #[doc = "Get the `toneMapping` field of this object."]
80    #[doc = ""]
81    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"]
82    #[doc = ""]
83    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
84    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
85    #[wasm_bindgen(method, getter = "toneMapping")]
86    pub fn get_tone_mapping(this: &GpuCanvasConfiguration) -> Option<GpuCanvasToneMapping>;
87    #[cfg(web_sys_unstable_apis)]
88    #[cfg(feature = "GpuCanvasToneMapping")]
89    #[doc = "Change the `toneMapping` field of this object."]
90    #[doc = ""]
91    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasToneMapping`*"]
92    #[doc = ""]
93    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
94    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
95    #[wasm_bindgen(method, setter = "toneMapping")]
96    pub fn set_tone_mapping(this: &GpuCanvasConfiguration, val: &GpuCanvasToneMapping);
97    #[cfg(web_sys_unstable_apis)]
98    #[doc = "Get the `usage` field of this object."]
99    #[doc = ""]
100    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
101    #[doc = ""]
102    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
103    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
104    #[wasm_bindgen(method, getter = "usage")]
105    pub fn get_usage(this: &GpuCanvasConfiguration) -> Option<u32>;
106    #[cfg(web_sys_unstable_apis)]
107    #[doc = "Change the `usage` field of this object."]
108    #[doc = ""]
109    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
110    #[doc = ""]
111    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
112    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
113    #[wasm_bindgen(method, setter = "usage")]
114    pub fn set_usage(this: &GpuCanvasConfiguration, val: u32);
115    #[cfg(web_sys_unstable_apis)]
116    #[doc = "Get the `viewFormats` field of this object."]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
119    #[doc = ""]
120    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
121    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
122    #[wasm_bindgen(method, getter = "viewFormats")]
123    pub fn get_view_formats(this: &GpuCanvasConfiguration) -> Option<::js_sys::Array>;
124    #[cfg(web_sys_unstable_apis)]
125    #[doc = "Change the `viewFormats` field of this object."]
126    #[doc = ""]
127    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
128    #[doc = ""]
129    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
130    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
131    #[wasm_bindgen(method, setter = "viewFormats")]
132    pub fn set_view_formats(this: &GpuCanvasConfiguration, val: &::wasm_bindgen::JsValue);
133}
134#[cfg(web_sys_unstable_apis)]
135impl GpuCanvasConfiguration {
136    #[cfg(all(feature = "GpuDevice", feature = "GpuTextureFormat",))]
137    #[doc = "Construct a new `GpuCanvasConfiguration`."]
138    #[doc = ""]
139    #[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`, `GpuTextureFormat`*"]
140    #[doc = ""]
141    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
142    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
143    pub fn new(device: &GpuDevice, format: GpuTextureFormat) -> Self {
144        #[allow(unused_mut)]
145        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
146        ret.set_device(device);
147        ret.set_format(format);
148        ret
149    }
150    #[cfg(web_sys_unstable_apis)]
151    #[cfg(feature = "GpuCanvasAlphaMode")]
152    #[deprecated = "Use `set_alpha_mode()` instead."]
153    pub fn alpha_mode(&mut self, val: GpuCanvasAlphaMode) -> &mut Self {
154        self.set_alpha_mode(val);
155        self
156    }
157    #[cfg(web_sys_unstable_apis)]
158    #[cfg(feature = "GpuDevice")]
159    #[deprecated = "Use `set_device()` instead."]
160    pub fn device(&mut self, val: &GpuDevice) -> &mut Self {
161        self.set_device(val);
162        self
163    }
164    #[cfg(web_sys_unstable_apis)]
165    #[cfg(feature = "GpuTextureFormat")]
166    #[deprecated = "Use `set_format()` instead."]
167    pub fn format(&mut self, val: GpuTextureFormat) -> &mut Self {
168        self.set_format(val);
169        self
170    }
171    #[cfg(web_sys_unstable_apis)]
172    #[cfg(feature = "GpuCanvasToneMapping")]
173    #[deprecated = "Use `set_tone_mapping()` instead."]
174    pub fn tone_mapping(&mut self, val: &GpuCanvasToneMapping) -> &mut Self {
175        self.set_tone_mapping(val);
176        self
177    }
178    #[cfg(web_sys_unstable_apis)]
179    #[deprecated = "Use `set_usage()` instead."]
180    pub fn usage(&mut self, val: u32) -> &mut Self {
181        self.set_usage(val);
182        self
183    }
184    #[cfg(web_sys_unstable_apis)]
185    #[deprecated = "Use `set_view_formats()` instead."]
186    pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
187        self.set_view_formats(val);
188        self
189    }
190}