maxcountryman_web_sys/features/
gen_ChannelPixelLayout.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ChannelPixelLayout)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `ChannelPixelLayout` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
11    pub type ChannelPixelLayout;
12}
13impl ChannelPixelLayout {
14    #[cfg(feature = "ChannelPixelLayoutDataType")]
15    #[doc = "Construct a new `ChannelPixelLayout`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`, `ChannelPixelLayoutDataType`*"]
18    pub fn new(
19        data_type: ChannelPixelLayoutDataType,
20        height: u32,
21        offset: u32,
22        skip: u32,
23        stride: u32,
24        width: u32,
25    ) -> Self {
26        #[allow(unused_mut)]
27        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
28        ret.data_type(data_type);
29        ret.height(height);
30        ret.offset(offset);
31        ret.skip(skip);
32        ret.stride(stride);
33        ret.width(width);
34        ret
35    }
36    #[cfg(feature = "ChannelPixelLayoutDataType")]
37    #[doc = "Change the `dataType` field of this object."]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`, `ChannelPixelLayoutDataType`*"]
40    pub fn data_type(&mut self, val: ChannelPixelLayoutDataType) -> &mut Self {
41        use wasm_bindgen::JsValue;
42        let r = ::js_sys::Reflect::set(
43            self.as_ref(),
44            &JsValue::from("dataType"),
45            &JsValue::from(val),
46        );
47        debug_assert!(
48            r.is_ok(),
49            "setting properties should never fail on our dictionary objects"
50        );
51        let _ = r;
52        self
53    }
54    #[doc = "Change the `height` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
57    pub fn height(&mut self, val: u32) -> &mut Self {
58        use wasm_bindgen::JsValue;
59        let r =
60            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("height"), &JsValue::from(val));
61        debug_assert!(
62            r.is_ok(),
63            "setting properties should never fail on our dictionary objects"
64        );
65        let _ = r;
66        self
67    }
68    #[doc = "Change the `offset` field of this object."]
69    #[doc = ""]
70    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
71    pub fn offset(&mut self, val: u32) -> &mut Self {
72        use wasm_bindgen::JsValue;
73        let r =
74            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("offset"), &JsValue::from(val));
75        debug_assert!(
76            r.is_ok(),
77            "setting properties should never fail on our dictionary objects"
78        );
79        let _ = r;
80        self
81    }
82    #[doc = "Change the `skip` field of this object."]
83    #[doc = ""]
84    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
85    pub fn skip(&mut self, val: u32) -> &mut Self {
86        use wasm_bindgen::JsValue;
87        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("skip"), &JsValue::from(val));
88        debug_assert!(
89            r.is_ok(),
90            "setting properties should never fail on our dictionary objects"
91        );
92        let _ = r;
93        self
94    }
95    #[doc = "Change the `stride` field of this object."]
96    #[doc = ""]
97    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
98    pub fn stride(&mut self, val: u32) -> &mut Self {
99        use wasm_bindgen::JsValue;
100        let r =
101            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("stride"), &JsValue::from(val));
102        debug_assert!(
103            r.is_ok(),
104            "setting properties should never fail on our dictionary objects"
105        );
106        let _ = r;
107        self
108    }
109    #[doc = "Change the `width` field of this object."]
110    #[doc = ""]
111    #[doc = "*This API requires the following crate features to be activated: `ChannelPixelLayout`*"]
112    pub fn width(&mut self, val: u32) -> &mut Self {
113        use wasm_bindgen::JsValue;
114        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("width"), &JsValue::from(val));
115        debug_assert!(
116            r.is_ok(),
117            "setting properties should never fail on our dictionary objects"
118        );
119        let _ = r;
120        self
121    }
122}