1 | #![allow (unused_imports)] |
2 | #![allow (clippy::all)] |
3 | use super::*; |
4 | use wasm_bindgen::prelude::*; |
5 | #[wasm_bindgen ] |
6 | extern "C" { |
7 | # [wasm_bindgen (extends = :: js_sys :: Object , js_name = WebGLContextAttributes)] |
8 | #[derive (Debug, Clone, PartialEq, Eq)] |
9 | #[doc = "The `WebGlContextAttributes` dictionary." ] |
10 | #[doc = "" ] |
11 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
12 | pub type WebGlContextAttributes; |
13 | } |
14 | impl WebGlContextAttributes { |
15 | #[doc = "Construct a new `WebGlContextAttributes`." ] |
16 | #[doc = "" ] |
17 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
18 | pub fn new() -> Self { |
19 | #[allow (unused_mut)] |
20 | let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); |
21 | ret |
22 | } |
23 | #[doc = "Change the `alpha` field of this object." ] |
24 | #[doc = "" ] |
25 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
26 | pub fn alpha(&mut self, val: bool) -> &mut Self { |
27 | use wasm_bindgen::JsValue; |
28 | let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("alpha" ), &JsValue::from(val)); |
29 | debug_assert!( |
30 | r.is_ok(), |
31 | "setting properties should never fail on our dictionary objects" |
32 | ); |
33 | let _ = r; |
34 | self |
35 | } |
36 | #[doc = "Change the `antialias` field of this object." ] |
37 | #[doc = "" ] |
38 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
39 | pub fn antialias(&mut self, val: bool) -> &mut Self { |
40 | use wasm_bindgen::JsValue; |
41 | let r = ::js_sys::Reflect::set( |
42 | self.as_ref(), |
43 | &JsValue::from("antialias" ), |
44 | &JsValue::from(val), |
45 | ); |
46 | debug_assert!( |
47 | r.is_ok(), |
48 | "setting properties should never fail on our dictionary objects" |
49 | ); |
50 | let _ = r; |
51 | self |
52 | } |
53 | #[doc = "Change the `depth` field of this object." ] |
54 | #[doc = "" ] |
55 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
56 | pub fn depth(&mut self, val: bool) -> &mut Self { |
57 | use wasm_bindgen::JsValue; |
58 | let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("depth" ), &JsValue::from(val)); |
59 | debug_assert!( |
60 | r.is_ok(), |
61 | "setting properties should never fail on our dictionary objects" |
62 | ); |
63 | let _ = r; |
64 | self |
65 | } |
66 | #[doc = "Change the `failIfMajorPerformanceCaveat` field of this object." ] |
67 | #[doc = "" ] |
68 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
69 | pub fn fail_if_major_performance_caveat(&mut self, val: bool) -> &mut Self { |
70 | use wasm_bindgen::JsValue; |
71 | let r = ::js_sys::Reflect::set( |
72 | self.as_ref(), |
73 | &JsValue::from("failIfMajorPerformanceCaveat" ), |
74 | &JsValue::from(val), |
75 | ); |
76 | debug_assert!( |
77 | r.is_ok(), |
78 | "setting properties should never fail on our dictionary objects" |
79 | ); |
80 | let _ = r; |
81 | self |
82 | } |
83 | #[cfg (feature = "WebGlPowerPreference" )] |
84 | #[doc = "Change the `powerPreference` field of this object." ] |
85 | #[doc = "" ] |
86 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`, `WebGlPowerPreference`*" ] |
87 | pub fn power_preference(&mut self, val: WebGlPowerPreference) -> &mut Self { |
88 | use wasm_bindgen::JsValue; |
89 | let r = ::js_sys::Reflect::set( |
90 | self.as_ref(), |
91 | &JsValue::from("powerPreference" ), |
92 | &JsValue::from(val), |
93 | ); |
94 | debug_assert!( |
95 | r.is_ok(), |
96 | "setting properties should never fail on our dictionary objects" |
97 | ); |
98 | let _ = r; |
99 | self |
100 | } |
101 | #[doc = "Change the `premultipliedAlpha` field of this object." ] |
102 | #[doc = "" ] |
103 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
104 | pub fn premultiplied_alpha(&mut self, val: bool) -> &mut Self { |
105 | use wasm_bindgen::JsValue; |
106 | let r = ::js_sys::Reflect::set( |
107 | self.as_ref(), |
108 | &JsValue::from("premultipliedAlpha" ), |
109 | &JsValue::from(val), |
110 | ); |
111 | debug_assert!( |
112 | r.is_ok(), |
113 | "setting properties should never fail on our dictionary objects" |
114 | ); |
115 | let _ = r; |
116 | self |
117 | } |
118 | #[doc = "Change the `preserveDrawingBuffer` field of this object." ] |
119 | #[doc = "" ] |
120 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
121 | pub fn preserve_drawing_buffer(&mut self, val: bool) -> &mut Self { |
122 | use wasm_bindgen::JsValue; |
123 | let r = ::js_sys::Reflect::set( |
124 | self.as_ref(), |
125 | &JsValue::from("preserveDrawingBuffer" ), |
126 | &JsValue::from(val), |
127 | ); |
128 | debug_assert!( |
129 | r.is_ok(), |
130 | "setting properties should never fail on our dictionary objects" |
131 | ); |
132 | let _ = r; |
133 | self |
134 | } |
135 | #[doc = "Change the `stencil` field of this object." ] |
136 | #[doc = "" ] |
137 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
138 | pub fn stencil(&mut self, val: bool) -> &mut Self { |
139 | use wasm_bindgen::JsValue; |
140 | let r = ::js_sys::Reflect::set( |
141 | self.as_ref(), |
142 | &JsValue::from("stencil" ), |
143 | &JsValue::from(val), |
144 | ); |
145 | debug_assert!( |
146 | r.is_ok(), |
147 | "setting properties should never fail on our dictionary objects" |
148 | ); |
149 | let _ = r; |
150 | self |
151 | } |
152 | #[cfg (web_sys_unstable_apis)] |
153 | #[doc = "Change the `xrCompatible` field of this object." ] |
154 | #[doc = "" ] |
155 | #[doc = "*This API requires the following crate features to be activated: `WebGlContextAttributes`*" ] |
156 | #[doc = "" ] |
157 | #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as" ] |
158 | #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*" ] |
159 | pub fn xr_compatible(&mut self, val: bool) -> &mut Self { |
160 | use wasm_bindgen::JsValue; |
161 | let r = ::js_sys::Reflect::set( |
162 | self.as_ref(), |
163 | &JsValue::from("xrCompatible" ), |
164 | &JsValue::from(val), |
165 | ); |
166 | debug_assert!( |
167 | r.is_ok(), |
168 | "setting properties should never fail on our dictionary objects" |
169 | ); |
170 | let _ = r; |
171 | self |
172 | } |
173 | } |
174 | impl Default for WebGlContextAttributes { |
175 | fn default() -> Self { |
176 | Self::new() |
177 | } |
178 | } |
179 | |