]> git.proxmox.com Git - rustc.git/blob - vendor/web-sys/src/features/gen_AudioBufferSourceOptions.rs
New upstream version 1.72.1+dfsg1
[rustc.git] / vendor / web-sys / src / features / gen_AudioBufferSourceOptions.rs
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 = AudioBufferSourceOptions)]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `AudioBufferSourceOptions` dictionary."]
10 #[doc = ""]
11 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
12 pub type AudioBufferSourceOptions;
13 }
14 impl AudioBufferSourceOptions {
15 #[doc = "Construct a new `AudioBufferSourceOptions`."]
16 #[doc = ""]
17 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
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 #[cfg(feature = "AudioBuffer")]
24 #[doc = "Change the `buffer` field of this object."]
25 #[doc = ""]
26 #[doc = "*This API requires the following crate features to be activated: `AudioBuffer`, `AudioBufferSourceOptions`*"]
27 pub fn buffer(&mut self, val: Option<&AudioBuffer>) -> &mut Self {
28 use wasm_bindgen::JsValue;
29 let r =
30 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("buffer"), &JsValue::from(val));
31 debug_assert!(
32 r.is_ok(),
33 "setting properties should never fail on our dictionary objects"
34 );
35 let _ = r;
36 self
37 }
38 #[doc = "Change the `detune` field of this object."]
39 #[doc = ""]
40 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
41 pub fn detune(&mut self, val: f32) -> &mut Self {
42 use wasm_bindgen::JsValue;
43 let r =
44 ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("detune"), &JsValue::from(val));
45 debug_assert!(
46 r.is_ok(),
47 "setting properties should never fail on our dictionary objects"
48 );
49 let _ = r;
50 self
51 }
52 #[doc = "Change the `loop` field of this object."]
53 #[doc = ""]
54 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
55 pub fn loop_(&mut self, val: bool) -> &mut Self {
56 use wasm_bindgen::JsValue;
57 let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("loop"), &JsValue::from(val));
58 debug_assert!(
59 r.is_ok(),
60 "setting properties should never fail on our dictionary objects"
61 );
62 let _ = r;
63 self
64 }
65 #[doc = "Change the `loopEnd` field of this object."]
66 #[doc = ""]
67 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
68 pub fn loop_end(&mut self, val: f64) -> &mut Self {
69 use wasm_bindgen::JsValue;
70 let r = ::js_sys::Reflect::set(
71 self.as_ref(),
72 &JsValue::from("loopEnd"),
73 &JsValue::from(val),
74 );
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 `loopStart` field of this object."]
83 #[doc = ""]
84 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
85 pub fn loop_start(&mut self, val: f64) -> &mut Self {
86 use wasm_bindgen::JsValue;
87 let r = ::js_sys::Reflect::set(
88 self.as_ref(),
89 &JsValue::from("loopStart"),
90 &JsValue::from(val),
91 );
92 debug_assert!(
93 r.is_ok(),
94 "setting properties should never fail on our dictionary objects"
95 );
96 let _ = r;
97 self
98 }
99 #[doc = "Change the `playbackRate` field of this object."]
100 #[doc = ""]
101 #[doc = "*This API requires the following crate features to be activated: `AudioBufferSourceOptions`*"]
102 pub fn playback_rate(&mut self, val: f32) -> &mut Self {
103 use wasm_bindgen::JsValue;
104 let r = ::js_sys::Reflect::set(
105 self.as_ref(),
106 &JsValue::from("playbackRate"),
107 &JsValue::from(val),
108 );
109 debug_assert!(
110 r.is_ok(),
111 "setting properties should never fail on our dictionary objects"
112 );
113 let _ = r;
114 self
115 }
116 }
117 impl Default for AudioBufferSourceOptions {
118 fn default() -> Self {
119 Self::new()
120 }
121 }