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    #[doc = "# Safety"]
63    #[doc = ""]
64    #[doc = "The `val` slice must outlive any use of the dictionary on the JavaScript side. wasm-bindgen passes a raw view into wasm linear memory — if the underlying data is freed or moved before JS is done reading the field, the behaviour is undefined. Prefer the `_array` variant (takes `&Uint8Array`) for a safe alternative that copies the data."]
65    #[wasm_bindgen(method, setter = "data")]
66    pub unsafe fn set_data_u8_slice(this: &ImageDecoderInit, val: &mut [u8]);
67    #[cfg(web_sys_unstable_apis)]
68    #[doc = "Change the `data` field of this object."]
69    #[doc = ""]
70    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
71    #[doc = ""]
72    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
73    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
74    #[wasm_bindgen(method, setter = "data")]
75    pub fn set_data_u8_array(this: &ImageDecoderInit, val: &::js_sys::Uint8Array);
76    #[cfg(web_sys_unstable_apis)]
77    #[cfg(feature = "ReadableStream")]
78    #[doc = "Change the `data` field of this object."]
79    #[doc = ""]
80    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `ReadableStream`*"]
81    #[doc = ""]
82    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
83    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
84    #[wasm_bindgen(method, setter = "data")]
85    pub fn set_data_readable_stream(this: &ImageDecoderInit, val: &ReadableStream);
86    #[cfg(web_sys_unstable_apis)]
87    #[doc = "Get the `desiredHeight` field of this object."]
88    #[doc = ""]
89    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
90    #[doc = ""]
91    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
92    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
93    #[wasm_bindgen(method, getter = "desiredHeight")]
94    pub fn get_desired_height(this: &ImageDecoderInit) -> Option<u32>;
95    #[cfg(web_sys_unstable_apis)]
96    #[doc = "Change the `desiredHeight` field of this object."]
97    #[doc = ""]
98    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
99    #[doc = ""]
100    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
101    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
102    #[wasm_bindgen(method, setter = "desiredHeight")]
103    pub fn set_desired_height(this: &ImageDecoderInit, val: u32);
104    #[cfg(web_sys_unstable_apis)]
105    #[doc = "Get the `desiredWidth` field of this object."]
106    #[doc = ""]
107    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
108    #[doc = ""]
109    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
110    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
111    #[wasm_bindgen(method, getter = "desiredWidth")]
112    pub fn get_desired_width(this: &ImageDecoderInit) -> Option<u32>;
113    #[cfg(web_sys_unstable_apis)]
114    #[doc = "Change the `desiredWidth` field of this object."]
115    #[doc = ""]
116    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
117    #[doc = ""]
118    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
119    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
120    #[wasm_bindgen(method, setter = "desiredWidth")]
121    pub fn set_desired_width(this: &ImageDecoderInit, val: u32);
122    #[cfg(web_sys_unstable_apis)]
123    #[doc = "Get the `preferAnimation` field of this object."]
124    #[doc = ""]
125    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
126    #[doc = ""]
127    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
128    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
129    #[wasm_bindgen(method, getter = "preferAnimation")]
130    pub fn get_prefer_animation(this: &ImageDecoderInit) -> Option<bool>;
131    #[cfg(web_sys_unstable_apis)]
132    #[doc = "Change the `preferAnimation` field of this object."]
133    #[doc = ""]
134    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
135    #[doc = ""]
136    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
137    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
138    #[wasm_bindgen(method, setter = "preferAnimation")]
139    pub fn set_prefer_animation(this: &ImageDecoderInit, val: bool);
140    #[cfg(web_sys_unstable_apis)]
141    #[doc = "Get the `transfer` field of this object."]
142    #[doc = ""]
143    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
144    #[doc = ""]
145    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
146    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
147    #[wasm_bindgen(method, getter = "transfer")]
148    pub fn get_transfer(this: &ImageDecoderInit) -> Option<::js_sys::Array<::js_sys::ArrayBuffer>>;
149    #[cfg(web_sys_unstable_apis)]
150    #[doc = "Change the `transfer` field of this object."]
151    #[doc = ""]
152    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
153    #[doc = ""]
154    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
155    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
156    #[wasm_bindgen(method, setter = "transfer")]
157    pub fn set_transfer(this: &ImageDecoderInit, val: &[::js_sys::ArrayBuffer]);
158    #[cfg(web_sys_unstable_apis)]
159    #[doc = "Get the `type` field of this object."]
160    #[doc = ""]
161    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
162    #[doc = ""]
163    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
164    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
165    #[wasm_bindgen(method, getter = "type")]
166    pub fn get_type(this: &ImageDecoderInit) -> ::alloc::string::String;
167    #[cfg(web_sys_unstable_apis)]
168    #[doc = "Change the `type` field of this object."]
169    #[doc = ""]
170    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
171    #[doc = ""]
172    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
173    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
174    #[wasm_bindgen(method, setter = "type")]
175    pub fn set_type(this: &ImageDecoderInit, val: &str);
176}
177#[cfg(web_sys_unstable_apis)]
178impl ImageDecoderInit {
179    #[doc = "Construct a new `ImageDecoderInit`."]
180    #[doc = ""]
181    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
182    #[doc = ""]
183    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
184    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
185    pub fn new(data: &::js_sys::Object, type_: &str) -> Self {
186        #[allow(unused_mut)]
187        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
188        ret.set_data(data);
189        ret.set_type(type_);
190        ret
191    }
192    #[doc = "Construct a new `ImageDecoderInit`."]
193    #[doc = ""]
194    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
195    #[doc = ""]
196    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
197    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
198    pub unsafe fn new_with_u8_slice(data: &mut [u8], type_: &str) -> Self {
199        #[allow(unused_mut)]
200        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
201        ret.set_data_u8_slice(data);
202        ret.set_type(type_);
203        ret
204    }
205    #[doc = "Construct a new `ImageDecoderInit`."]
206    #[doc = ""]
207    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"]
208    #[doc = ""]
209    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
210    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
211    pub fn new_with_u8_array(data: &::js_sys::Uint8Array, type_: &str) -> Self {
212        #[allow(unused_mut)]
213        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
214        ret.set_data_u8_array(data);
215        ret.set_type(type_);
216        ret
217    }
218    #[cfg(feature = "ReadableStream")]
219    #[doc = "Construct a new `ImageDecoderInit`."]
220    #[doc = ""]
221    #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `ReadableStream`*"]
222    #[doc = ""]
223    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
224    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
225    pub fn new_with_readable_stream(data: &ReadableStream, type_: &str) -> Self {
226        #[allow(unused_mut)]
227        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
228        ret.set_data_readable_stream(data);
229        ret.set_type(type_);
230        ret
231    }
232    #[cfg(web_sys_unstable_apis)]
233    #[cfg(feature = "ColorSpaceConversion")]
234    #[deprecated = "Use `set_color_space_conversion()` instead."]
235    pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self {
236        self.set_color_space_conversion(val);
237        self
238    }
239    #[cfg(web_sys_unstable_apis)]
240    #[deprecated = "Use `set_data()` instead."]
241    pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self {
242        self.set_data(val);
243        self
244    }
245    #[cfg(web_sys_unstable_apis)]
246    #[deprecated = "Use `set_desired_height()` instead."]
247    pub fn desired_height(&mut self, val: u32) -> &mut Self {
248        self.set_desired_height(val);
249        self
250    }
251    #[cfg(web_sys_unstable_apis)]
252    #[deprecated = "Use `set_desired_width()` instead."]
253    pub fn desired_width(&mut self, val: u32) -> &mut Self {
254        self.set_desired_width(val);
255        self
256    }
257    #[cfg(web_sys_unstable_apis)]
258    #[deprecated = "Use `set_prefer_animation()` instead."]
259    pub fn prefer_animation(&mut self, val: bool) -> &mut Self {
260        self.set_prefer_animation(val);
261        self
262    }
263    #[cfg(web_sys_unstable_apis)]
264    #[deprecated = "Use `set_transfer()` instead."]
265    pub fn transfer(&mut self, val: &[::js_sys::ArrayBuffer]) -> &mut Self {
266        self.set_transfer(val);
267        self
268    }
269    #[cfg(web_sys_unstable_apis)]
270    #[deprecated = "Use `set_type()` instead."]
271    pub fn type_(&mut self, val: &str) -> &mut Self {
272        self.set_type(val);
273        self
274    }
275}