webbind 0.1.44

Rust bindings for the web api, auto-generated from WebIDL
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
use super::*;

/// The XRSession class.
/// [`XRSession`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct XRSession {
    inner: EventTarget,
}

impl FromVal for XRSession {
    fn from_val(v: &Any) -> Self {
        XRSession {
            inner: EventTarget::from_val(v),
        }
    }
    fn take_ownership(v: AnyHandle) -> Self {
        Self::from_val(&Any::take_ownership(v))
    }
    fn as_handle(&self) -> AnyHandle {
        self.inner.as_handle()
    }
}

impl core::ops::Deref for XRSession {
    type Target = EventTarget;
    fn deref(&self) -> &Self::Target {
        &self.inner
    }
}

impl core::ops::DerefMut for XRSession {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.inner
    }
}

impl AsRef<Any> for XRSession {
    fn as_ref(&self) -> &Any {
        &self.inner
    }
}

impl AsMut<Any> for XRSession {
    fn as_mut(&mut self) -> &mut Any {
        &mut self.inner
    }
}

impl From<XRSession> for Any {
    fn from(s: XRSession) -> Any {
        let handle = s.inner.as_handle();
        core::mem::forget(s);
        Any::take_ownership(handle)
    }
}

impl From<&XRSession> for Any {
    fn from(s: &XRSession) -> Any {
        s.inner.clone().into()
    }
}

jsbind::utils::impl_dyn_cast!(XRSession);

impl XRSession {
    /// Getter of the `visibilityState` attribute.
    /// [`XRSession.visibilityState`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/visibilityState)
    pub fn visibility_state(&self) -> XRVisibilityState {
        self.inner.get("visibilityState").as_::<XRVisibilityState>()
    }
}
impl XRSession {
    /// Getter of the `frameRate` attribute.
    /// [`XRSession.frameRate`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/frameRate)
    pub fn frame_rate(&self) -> f32 {
        self.inner.get("frameRate").as_::<f32>()
    }
}
impl XRSession {
    /// Getter of the `supportedFrameRates` attribute.
    /// [`XRSession.supportedFrameRates`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/supportedFrameRates)
    pub fn supported_frame_rates(&self) -> Float32Array {
        self.inner.get("supportedFrameRates").as_::<Float32Array>()
    }
}
impl XRSession {
    /// Getter of the `renderState` attribute.
    /// [`XRSession.renderState`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/renderState)
    pub fn render_state(&self) -> XRRenderState {
        self.inner.get("renderState").as_::<XRRenderState>()
    }
}
impl XRSession {
    /// Getter of the `inputSources` attribute.
    /// [`XRSession.inputSources`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/inputSources)
    pub fn input_sources(&self) -> XRInputSourceArray {
        self.inner.get("inputSources").as_::<XRInputSourceArray>()
    }
}
impl XRSession {
    /// Getter of the `trackedSources` attribute.
    /// [`XRSession.trackedSources`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/trackedSources)
    pub fn tracked_sources(&self) -> XRInputSourceArray {
        self.inner.get("trackedSources").as_::<XRInputSourceArray>()
    }
}
impl XRSession {
    /// Getter of the `enabledFeatures` attribute.
    /// [`XRSession.enabledFeatures`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/enabledFeatures)
    pub fn enabled_features(&self) -> TypedArray<JsString> {
        self.inner
            .get("enabledFeatures")
            .as_::<TypedArray<JsString>>()
    }
}
impl XRSession {
    /// Getter of the `isSystemKeyboardSupported` attribute.
    /// [`XRSession.isSystemKeyboardSupported`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/isSystemKeyboardSupported)
    pub fn is_system_keyboard_supported(&self) -> bool {
        self.inner.get("isSystemKeyboardSupported").as_::<bool>()
    }
}
impl XRSession {
    /// Getter of the `onend` attribute.
    /// [`XRSession.onend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onend)
    pub fn onend(&self) -> Any {
        self.inner.get("onend").as_::<Any>()
    }

    /// Setter of the `onend` attribute.
    /// [`XRSession.onend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onend)
    pub fn set_onend(&mut self, value: &Any) {
        self.inner.set("onend", value);
    }
}
impl XRSession {
    /// Getter of the `oninputsourceschange` attribute.
    /// [`XRSession.oninputsourceschange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)
    pub fn oninputsourceschange(&self) -> Any {
        self.inner.get("oninputsourceschange").as_::<Any>()
    }

    /// Setter of the `oninputsourceschange` attribute.
    /// [`XRSession.oninputsourceschange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/oninputsourceschange)
    pub fn set_oninputsourceschange(&mut self, value: &Any) {
        self.inner.set("oninputsourceschange", value);
    }
}
impl XRSession {
    /// Getter of the `onselect` attribute.
    /// [`XRSession.onselect`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)
    pub fn onselect(&self) -> Any {
        self.inner.get("onselect").as_::<Any>()
    }

    /// Setter of the `onselect` attribute.
    /// [`XRSession.onselect`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselect)
    pub fn set_onselect(&mut self, value: &Any) {
        self.inner.set("onselect", value);
    }
}
impl XRSession {
    /// Getter of the `onselectstart` attribute.
    /// [`XRSession.onselectstart`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselectstart)
    pub fn onselectstart(&self) -> Any {
        self.inner.get("onselectstart").as_::<Any>()
    }

    /// Setter of the `onselectstart` attribute.
    /// [`XRSession.onselectstart`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselectstart)
    pub fn set_onselectstart(&mut self, value: &Any) {
        self.inner.set("onselectstart", value);
    }
}
impl XRSession {
    /// Getter of the `onselectend` attribute.
    /// [`XRSession.onselectend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselectend)
    pub fn onselectend(&self) -> Any {
        self.inner.get("onselectend").as_::<Any>()
    }

    /// Setter of the `onselectend` attribute.
    /// [`XRSession.onselectend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onselectend)
    pub fn set_onselectend(&mut self, value: &Any) {
        self.inner.set("onselectend", value);
    }
}
impl XRSession {
    /// Getter of the `onsqueeze` attribute.
    /// [`XRSession.onsqueeze`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueeze)
    pub fn onsqueeze(&self) -> Any {
        self.inner.get("onsqueeze").as_::<Any>()
    }

    /// Setter of the `onsqueeze` attribute.
    /// [`XRSession.onsqueeze`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueeze)
    pub fn set_onsqueeze(&mut self, value: &Any) {
        self.inner.set("onsqueeze", value);
    }
}
impl XRSession {
    /// Getter of the `onsqueezestart` attribute.
    /// [`XRSession.onsqueezestart`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezestart)
    pub fn onsqueezestart(&self) -> Any {
        self.inner.get("onsqueezestart").as_::<Any>()
    }

    /// Setter of the `onsqueezestart` attribute.
    /// [`XRSession.onsqueezestart`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezestart)
    pub fn set_onsqueezestart(&mut self, value: &Any) {
        self.inner.set("onsqueezestart", value);
    }
}
impl XRSession {
    /// Getter of the `onsqueezeend` attribute.
    /// [`XRSession.onsqueezeend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezeend)
    pub fn onsqueezeend(&self) -> Any {
        self.inner.get("onsqueezeend").as_::<Any>()
    }

    /// Setter of the `onsqueezeend` attribute.
    /// [`XRSession.onsqueezeend`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onsqueezeend)
    pub fn set_onsqueezeend(&mut self, value: &Any) {
        self.inner.set("onsqueezeend", value);
    }
}
impl XRSession {
    /// Getter of the `onvisibilitychange` attribute.
    /// [`XRSession.onvisibilitychange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onvisibilitychange)
    pub fn onvisibilitychange(&self) -> Any {
        self.inner.get("onvisibilitychange").as_::<Any>()
    }

    /// Setter of the `onvisibilitychange` attribute.
    /// [`XRSession.onvisibilitychange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onvisibilitychange)
    pub fn set_onvisibilitychange(&mut self, value: &Any) {
        self.inner.set("onvisibilitychange", value);
    }
}
impl XRSession {
    /// Getter of the `onframeratechange` attribute.
    /// [`XRSession.onframeratechange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onframeratechange)
    pub fn onframeratechange(&self) -> Any {
        self.inner.get("onframeratechange").as_::<Any>()
    }

    /// Setter of the `onframeratechange` attribute.
    /// [`XRSession.onframeratechange`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/onframeratechange)
    pub fn set_onframeratechange(&mut self, value: &Any) {
        self.inner.set("onframeratechange", value);
    }
}
impl XRSession {
    /// Getter of the `persistentAnchors` attribute.
    /// [`XRSession.persistentAnchors`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/persistentAnchors)
    pub fn persistent_anchors(&self) -> TypedArray<JsString> {
        self.inner
            .get("persistentAnchors")
            .as_::<TypedArray<JsString>>()
    }
}
impl XRSession {
    /// Getter of the `environmentBlendMode` attribute.
    /// [`XRSession.environmentBlendMode`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/environmentBlendMode)
    pub fn environment_blend_mode(&self) -> XREnvironmentBlendMode {
        self.inner
            .get("environmentBlendMode")
            .as_::<XREnvironmentBlendMode>()
    }
}
impl XRSession {
    /// Getter of the `interactionMode` attribute.
    /// [`XRSession.interactionMode`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/interactionMode)
    pub fn interaction_mode(&self) -> XRInteractionMode {
        self.inner.get("interactionMode").as_::<XRInteractionMode>()
    }
}
impl XRSession {
    /// Getter of the `depthUsage` attribute.
    /// [`XRSession.depthUsage`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/depthUsage)
    pub fn depth_usage(&self) -> XRDepthUsage {
        self.inner.get("depthUsage").as_::<XRDepthUsage>()
    }
}
impl XRSession {
    /// Getter of the `depthDataFormat` attribute.
    /// [`XRSession.depthDataFormat`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/depthDataFormat)
    pub fn depth_data_format(&self) -> XRDepthDataFormat {
        self.inner.get("depthDataFormat").as_::<XRDepthDataFormat>()
    }
}
impl XRSession {
    /// Getter of the `depthType` attribute.
    /// [`XRSession.depthType`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/depthType)
    pub fn depth_type(&self) -> XRDepthType {
        self.inner.get("depthType").as_::<XRDepthType>()
    }
}
impl XRSession {
    /// Getter of the `depthActive` attribute.
    /// [`XRSession.depthActive`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/depthActive)
    pub fn depth_active(&self) -> bool {
        self.inner.get("depthActive").as_::<bool>()
    }
}
impl XRSession {
    /// Getter of the `domOverlayState` attribute.
    /// [`XRSession.domOverlayState`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/domOverlayState)
    pub fn dom_overlay_state(&self) -> XRDOMOverlayState {
        self.inner.get("domOverlayState").as_::<XRDOMOverlayState>()
    }
}
impl XRSession {
    /// Getter of the `preferredReflectionFormat` attribute.
    /// [`XRSession.preferredReflectionFormat`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/preferredReflectionFormat)
    pub fn preferred_reflection_format(&self) -> XRReflectionFormat {
        self.inner
            .get("preferredReflectionFormat")
            .as_::<XRReflectionFormat>()
    }
}
impl XRSession {
    /// The updateRenderState method.
    /// [`XRSession.updateRenderState`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/updateRenderState)
    pub fn update_render_state(&self) -> Undefined {
        self.inner.call("updateRenderState", &[]).as_::<Undefined>()
    }
}
impl XRSession {
    /// The updateRenderState method.
    /// [`XRSession.updateRenderState`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/updateRenderState)
    pub fn update_render_state_with_state(&self, state: &XRRenderStateInit) -> Undefined {
        self.inner
            .call("updateRenderState", &[state.into()])
            .as_::<Undefined>()
    }
}
impl XRSession {
    /// The updateTargetFrameRate method.
    /// [`XRSession.updateTargetFrameRate`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/updateTargetFrameRate)
    pub fn update_target_frame_rate(&self, rate: f32) -> Promise<Undefined> {
        self.inner
            .call("updateTargetFrameRate", &[rate.into()])
            .as_::<Promise<Undefined>>()
    }
}
impl XRSession {
    /// The requestReferenceSpace method.
    /// [`XRSession.requestReferenceSpace`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestReferenceSpace)
    pub fn request_reference_space(
        &self,
        type_: &XRReferenceSpaceType,
    ) -> Promise<XRReferenceSpace> {
        self.inner
            .call("requestReferenceSpace", &[type_.into()])
            .as_::<Promise<XRReferenceSpace>>()
    }
}
impl XRSession {
    /// The requestAnimationFrame method.
    /// [`XRSession.requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestAnimationFrame)
    pub fn request_animation_frame(&self, callback: &Function) -> u32 {
        self.inner
            .call("requestAnimationFrame", &[callback.into()])
            .as_::<u32>()
    }
}
impl XRSession {
    /// The cancelAnimationFrame method.
    /// [`XRSession.cancelAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/cancelAnimationFrame)
    pub fn cancel_animation_frame(&self, handle: u32) -> Undefined {
        self.inner
            .call("cancelAnimationFrame", &[handle.into()])
            .as_::<Undefined>()
    }
}
impl XRSession {
    /// The end method.
    /// [`XRSession.end`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/end)
    pub fn end(&self) -> Promise<Undefined> {
        self.inner.call("end", &[]).as_::<Promise<Undefined>>()
    }
}
impl XRSession {
    /// The restorePersistentAnchor method.
    /// [`XRSession.restorePersistentAnchor`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/restorePersistentAnchor)
    pub fn restore_persistent_anchor(&self, uuid: &JsString) -> Promise<XRAnchor> {
        self.inner
            .call("restorePersistentAnchor", &[uuid.into()])
            .as_::<Promise<XRAnchor>>()
    }
}
impl XRSession {
    /// The deletePersistentAnchor method.
    /// [`XRSession.deletePersistentAnchor`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/deletePersistentAnchor)
    pub fn delete_persistent_anchor(&self, uuid: &JsString) -> Promise<Undefined> {
        self.inner
            .call("deletePersistentAnchor", &[uuid.into()])
            .as_::<Promise<Undefined>>()
    }
}
impl XRSession {
    /// The pauseDepthSensing method.
    /// [`XRSession.pauseDepthSensing`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/pauseDepthSensing)
    pub fn pause_depth_sensing(&self) -> Undefined {
        self.inner.call("pauseDepthSensing", &[]).as_::<Undefined>()
    }
}
impl XRSession {
    /// The resumeDepthSensing method.
    /// [`XRSession.resumeDepthSensing`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/resumeDepthSensing)
    pub fn resume_depth_sensing(&self) -> Undefined {
        self.inner
            .call("resumeDepthSensing", &[])
            .as_::<Undefined>()
    }
}
impl XRSession {
    /// The requestHitTestSource method.
    /// [`XRSession.requestHitTestSource`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestHitTestSource)
    pub fn request_hit_test_source(
        &self,
        options: &XRHitTestOptionsInit,
    ) -> Promise<XRHitTestSource> {
        self.inner
            .call("requestHitTestSource", &[options.into()])
            .as_::<Promise<XRHitTestSource>>()
    }
}
impl XRSession {
    /// The requestHitTestSourceForTransientInput method.
    /// [`XRSession.requestHitTestSourceForTransientInput`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestHitTestSourceForTransientInput)
    pub fn request_hit_test_source_for_transient_input(
        &self,
        options: &XRTransientInputHitTestOptionsInit,
    ) -> Promise<XRTransientInputHitTestSource> {
        self.inner
            .call("requestHitTestSourceForTransientInput", &[options.into()])
            .as_::<Promise<XRTransientInputHitTestSource>>()
    }
}
impl XRSession {
    /// The requestLightProbe method.
    /// [`XRSession.requestLightProbe`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestLightProbe)
    pub fn request_light_probe(&self) -> Promise<XRLightProbe> {
        self.inner
            .call("requestLightProbe", &[])
            .as_::<Promise<XRLightProbe>>()
    }
}
impl XRSession {
    /// The requestLightProbe method.
    /// [`XRSession.requestLightProbe`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/requestLightProbe)
    pub fn request_light_probe_with_options(
        &self,
        options: &XRLightProbeInit,
    ) -> Promise<XRLightProbe> {
        self.inner
            .call("requestLightProbe", &[options.into()])
            .as_::<Promise<XRLightProbe>>()
    }
}
impl XRSession {
    /// The initiateRoomCapture method.
    /// [`XRSession.initiateRoomCapture`](https://developer.mozilla.org/en-US/docs/Web/API/XRSession/initiateRoomCapture)
    pub fn initiate_room_capture(&self) -> Promise<Undefined> {
        self.inner
            .call("initiateRoomCapture", &[])
            .as_::<Promise<Undefined>>()
    }
}