Skip to main content

web_sys/features/
gen_ImageDecoderInit.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 = ImageDecoderInit)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `ImageDecoderInit` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type ImageDecoderInit;
17    #[cfg(web_sys_unstable_apis)]
18    #[cfg(feature = "ColorSpaceConversion")]
19    #[doc = "Get the `colorSpaceConversion` field of this object."]
20    #[doc = ""]
21    #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageDecoderInit`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
25    #[wasm_bindgen(method, getter = "colorSpaceConversion")]
26    pub fn get_color_space_conversion(this: &ImageDecoderInit) -> Option<ColorSpaceConversion>;
27    #[cfg(web_sys_unstable_apis)]
28    #[cfg(feature = "ColorSpaceConversion")]
29    #[doc = "Change the `colorSpaceConversion` field of this object."]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageDecoderInit`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
35    #[wasm_bindgen(method, setter = "colorSpaceConversion")]
36    pub fn set_color_space_conversion(this: &ImageDecoderInit, val: ColorSpaceConversion);
37    #[cfg(web_sys_unstable_apis)]
38    #[doc = "Get the `data` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
41    #[doc = ""]
42    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
43    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
44    #[wasm_bindgen(method, getter = "data")]
45    pub fn get_data(this: &ImageDecoderInit) -> ::wasm_bindgen::JsValue;
46    #[cfg(web_sys_unstable_apis)]
47    #[doc = "Change the `data` field of this object."]
48    #[doc = ""]
49    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
50    #[doc = ""]
51    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
52    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
53    #[wasm_bindgen(method, setter = "data")]
54    pub fn set_data(this: &ImageDecoderInit, val: &::js_sys::Object);
55    #[cfg(web_sys_unstable_apis)]
56    #[doc = "Change the `data` field of this object."]
57    #[doc = ""]
58    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
59    #[doc = ""]
60    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
61    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
62    #[wasm_bindgen(method, setter = "data")]
63    pub fn set_data_u8_slice(this: &ImageDecoderInit, val: &mut [u8]);
64    #[cfg(web_sys_unstable_apis)]
65    #[doc = "Change the `data` field of this object."]
66    #[doc = ""]
67    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
71    #[wasm_bindgen(method, setter = "data")]
72    pub fn set_data_u8_array(this: &ImageDecoderInit, val: &::js_sys::Uint8Array);
73    #[cfg(web_sys_unstable_apis)]
74    #[cfg(feature = "ReadableStream")]
75    #[doc = "Change the `data` field of this object."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
78    #[doc = ""]
79    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
80    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
81    #[wasm_bindgen(method, setter = "data")]
82    pub fn set_data_readable_stream(this: &ImageDecoderInit, val: &ReadableStream);
83    #[cfg(web_sys_unstable_apis)]
84    #[doc = "Get the `desiredHeight` field of this object."]
85    #[doc = ""]
86    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
87    #[doc = ""]
88    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
89    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
90    #[wasm_bindgen(method, getter = "desiredHeight")]
91    pub fn get_desired_height(this: &ImageDecoderInit) -> Option<u32>;
92    #[cfg(web_sys_unstable_apis)]
93    #[doc = "Change the `desiredHeight` field of this object."]
94    #[doc = ""]
95    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
96    #[doc = ""]
97    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
98    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
99    #[wasm_bindgen(method, setter = "desiredHeight")]
100    pub fn set_desired_height(this: &ImageDecoderInit, val: u32);
101    #[cfg(web_sys_unstable_apis)]
102    #[doc = "Get the `desiredWidth` field of this object."]
103    #[doc = ""]
104    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
105    #[doc = ""]
106    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
107    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
108    #[wasm_bindgen(method, getter = "desiredWidth")]
109    pub fn get_desired_width(this: &ImageDecoderInit) -> Option<u32>;
110    #[cfg(web_sys_unstable_apis)]
111    #[doc = "Change the `desiredWidth` field of this object."]
112    #[doc = ""]
113    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
114    #[doc = ""]
115    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
116    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
117    #[wasm_bindgen(method, setter = "desiredWidth")]
118    pub fn set_desired_width(this: &ImageDecoderInit, val: u32);
119    #[cfg(web_sys_unstable_apis)]
120    #[doc = "Get the `preferAnimation` field of this object."]
121    #[doc = ""]
122    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
123    #[doc = ""]
124    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
125    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
126    #[wasm_bindgen(method, getter = "preferAnimation")]
127    pub fn get_prefer_animation(this: &ImageDecoderInit) -> Option<bool>;
128    #[cfg(web_sys_unstable_apis)]
129    #[doc = "Change the `preferAnimation` field of this object."]
130    #[doc = ""]
131    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
132    #[doc = ""]
133    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
134    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
135    #[wasm_bindgen(method, setter = "preferAnimation")]
136    pub fn set_prefer_animation(this: &ImageDecoderInit, val: bool);
137    #[cfg(web_sys_unstable_apis)]
138    #[doc = "Get the `transfer` field of this object."]
139    #[doc = ""]
140    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
141    #[doc = ""]
142    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
143    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
144    #[wasm_bindgen(method, getter = "transfer")]
145    pub fn get_transfer(this: &ImageDecoderInit) -> Option<::js_sys::Array<::js_sys::ArrayBuffer>>;
146    #[cfg(web_sys_unstable_apis)]
147    #[doc = "Change the `transfer` field of this object."]
148    #[doc = ""]
149    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
150    #[doc = ""]
151    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
152    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
153    #[wasm_bindgen(method, setter = "transfer")]
154    pub fn set_transfer(this: &ImageDecoderInit, val: &[::js_sys::ArrayBuffer]);
155    #[cfg(web_sys_unstable_apis)]
156    #[doc = "Get the `type` field of this object."]
157    #[doc = ""]
158    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
159    #[doc = ""]
160    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
161    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
162    #[wasm_bindgen(method, getter = "type")]
163    pub fn get_type(this: &ImageDecoderInit) -> ::alloc::string::String;
164    #[cfg(web_sys_unstable_apis)]
165    #[doc = "Change the `type` field of this object."]
166    #[doc = ""]
167    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
168    #[doc = ""]
169    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
170    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
171    #[wasm_bindgen(method, setter = "type")]
172    pub fn set_type(this: &ImageDecoderInit, val: &str);
173}
174#[cfg(web_sys_unstable_apis)]
175impl ImageDecoderInit {
176    #[doc = "Construct a new `ImageDecoderInit`."]
177    #[doc = ""]
178    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
179    #[doc = ""]
180    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
181    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
182    pub fn new(data: &::js_sys::Object, type_: &str) -> Self {
183        #[allow(unused_mut)]
184        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
185        ret.set_data(data);
186        ret.set_type(type_);
187        ret
188    }
189    #[doc = "Construct a new `ImageDecoderInit`."]
190    #[doc = ""]
191    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
192    #[doc = ""]
193    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
194    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
195    pub fn new_with_u8_slice(data: &mut [u8], type_: &str) -> Self {
196        #[allow(unused_mut)]
197        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
198        ret.set_data_u8_slice(data);
199        ret.set_type(type_);
200        ret
201    }
202    #[doc = "Construct a new `ImageDecoderInit`."]
203    #[doc = ""]
204    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
205    #[doc = ""]
206    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
207    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
208    pub fn new_with_u8_array(data: &::js_sys::Uint8Array, type_: &str) -> Self {
209        #[allow(unused_mut)]
210        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
211        ret.set_data_u8_array(data);
212        ret.set_type(type_);
213        ret
214    }
215    #[cfg(feature = "ReadableStream")]
216    #[doc = "Construct a new `ImageDecoderInit`."]
217    #[doc = ""]
218    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `ReadableStream`*"]
219    #[doc = ""]
220    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
221    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
222    pub fn new_with_readable_stream(data: &ReadableStream, type_: &str) -> Self {
223        #[allow(unused_mut)]
224        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
225        ret.set_data_readable_stream(data);
226        ret.set_type(type_);
227        ret
228    }
229    #[cfg(web_sys_unstable_apis)]
230    #[cfg(feature = "ColorSpaceConversion")]
231    #[deprecated = "Use `set_color_space_conversion()` instead."]
232    pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self {
233        self.set_color_space_conversion(val);
234        self
235    }
236    #[cfg(web_sys_unstable_apis)]
237    #[deprecated = "Use `set_data()` instead."]
238    pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self {
239        self.set_data(val);
240        self
241    }
242    #[cfg(web_sys_unstable_apis)]
243    #[deprecated = "Use `set_desired_height()` instead."]
244    pub fn desired_height(&mut self, val: u32) -> &mut Self {
245        self.set_desired_height(val);
246        self
247    }
248    #[cfg(web_sys_unstable_apis)]
249    #[deprecated = "Use `set_desired_width()` instead."]
250    pub fn desired_width(&mut self, val: u32) -> &mut Self {
251        self.set_desired_width(val);
252        self
253    }
254    #[cfg(web_sys_unstable_apis)]
255    #[deprecated = "Use `set_prefer_animation()` instead."]
256    pub fn prefer_animation(&mut self, val: bool) -> &mut Self {
257        self.set_prefer_animation(val);
258        self
259    }
260    #[cfg(web_sys_unstable_apis)]
261    #[deprecated = "Use `set_transfer()` instead."]
262    pub fn transfer(&mut self, val: &[::js_sys::ArrayBuffer]) -> &mut Self {
263        self.set_transfer(val);
264        self
265    }
266    #[cfg(web_sys_unstable_apis)]
267    #[deprecated = "Use `set_type()` instead."]
268    pub fn type_(&mut self, val: &str) -> &mut Self {
269        self.set_type(val);
270        self
271    }
272}