Skip to main content

web_sys/features/
gen_EncodedAudioChunkInit.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 = EncodedAudioChunkInit)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `EncodedAudioChunkInit` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
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 EncodedAudioChunkInit;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `data` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
21    #[doc = ""]
22    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
23    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
24    #[wasm_bindgen(method, getter = "data")]
25    pub fn get_data(this: &EncodedAudioChunkInit) -> ::js_sys::Object;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `data` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
30    #[doc = ""]
31    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
32    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
33    #[wasm_bindgen(method, setter = "data")]
34    pub fn set_data(this: &EncodedAudioChunkInit, val: &::js_sys::Object);
35    #[cfg(web_sys_unstable_apis)]
36    #[doc = "Change the `data` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
39    #[doc = ""]
40    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
41    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
42    #[wasm_bindgen(method, setter = "data")]
43    pub fn set_data_u8_slice(this: &EncodedAudioChunkInit, val: &mut [u8]);
44    #[cfg(web_sys_unstable_apis)]
45    #[doc = "Change the `data` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
48    #[doc = ""]
49    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
51    #[wasm_bindgen(method, setter = "data")]
52    pub fn set_data_u8_array(this: &EncodedAudioChunkInit, val: &::js_sys::Uint8Array);
53    #[cfg(web_sys_unstable_apis)]
54    #[doc = "Get the `duration` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
57    #[doc = ""]
58    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
59    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
60    #[wasm_bindgen(method, getter = "duration")]
61    pub fn get_duration(this: &EncodedAudioChunkInit) -> Option<f64>;
62    #[cfg(web_sys_unstable_apis)]
63    #[doc = "Change the `duration` field of this object."]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
66    #[doc = ""]
67    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
68    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
69    #[wasm_bindgen(method, setter = "duration")]
70    pub fn set_duration(this: &EncodedAudioChunkInit, val: u32);
71    #[cfg(web_sys_unstable_apis)]
72    #[doc = "Change the `duration` field of this object."]
73    #[doc = ""]
74    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
75    #[doc = ""]
76    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
77    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
78    #[wasm_bindgen(method, setter = "duration")]
79    pub fn set_duration_f64(this: &EncodedAudioChunkInit, val: f64);
80    #[cfg(web_sys_unstable_apis)]
81    #[doc = "Get the `timestamp` field of this object."]
82    #[doc = ""]
83    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
84    #[doc = ""]
85    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
86    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
87    #[wasm_bindgen(method, getter = "timestamp")]
88    pub fn get_timestamp(this: &EncodedAudioChunkInit) -> f64;
89    #[cfg(web_sys_unstable_apis)]
90    #[doc = "Change the `timestamp` field of this object."]
91    #[doc = ""]
92    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
93    #[doc = ""]
94    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
95    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
96    #[wasm_bindgen(method, setter = "timestamp")]
97    pub fn set_timestamp(this: &EncodedAudioChunkInit, val: i32);
98    #[cfg(web_sys_unstable_apis)]
99    #[doc = "Change the `timestamp` field of this object."]
100    #[doc = ""]
101    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
102    #[doc = ""]
103    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
104    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
105    #[wasm_bindgen(method, setter = "timestamp")]
106    pub fn set_timestamp_f64(this: &EncodedAudioChunkInit, val: f64);
107    #[cfg(web_sys_unstable_apis)]
108    #[doc = "Get the `transfer` field of this object."]
109    #[doc = ""]
110    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
111    #[doc = ""]
112    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
113    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
114    #[wasm_bindgen(method, getter = "transfer")]
115    pub fn get_transfer(
116        this: &EncodedAudioChunkInit,
117    ) -> Option<::js_sys::Array<::js_sys::ArrayBuffer>>;
118    #[cfg(web_sys_unstable_apis)]
119    #[doc = "Change the `transfer` field of this object."]
120    #[doc = ""]
121    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`*"]
122    #[doc = ""]
123    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
124    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
125    #[wasm_bindgen(method, setter = "transfer")]
126    pub fn set_transfer(this: &EncodedAudioChunkInit, val: &[::js_sys::ArrayBuffer]);
127    #[cfg(web_sys_unstable_apis)]
128    #[cfg(feature = "EncodedAudioChunkType")]
129    #[doc = "Get the `type` field of this object."]
130    #[doc = ""]
131    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"]
132    #[doc = ""]
133    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
134    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
135    #[wasm_bindgen(method, getter = "type")]
136    pub fn get_type(this: &EncodedAudioChunkInit) -> EncodedAudioChunkType;
137    #[cfg(web_sys_unstable_apis)]
138    #[cfg(feature = "EncodedAudioChunkType")]
139    #[doc = "Change the `type` field of this object."]
140    #[doc = ""]
141    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"]
142    #[doc = ""]
143    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
144    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
145    #[wasm_bindgen(method, setter = "type")]
146    pub fn set_type(this: &EncodedAudioChunkInit, val: EncodedAudioChunkType);
147}
148#[cfg(web_sys_unstable_apis)]
149impl EncodedAudioChunkInit {
150    #[cfg(feature = "EncodedAudioChunkType")]
151    #[doc = "Construct a new `EncodedAudioChunkInit`."]
152    #[doc = ""]
153    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"]
154    #[doc = ""]
155    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
156    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
157    pub fn new(data: &::js_sys::Object, timestamp: i32, type_: EncodedAudioChunkType) -> Self {
158        #[allow(unused_mut)]
159        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
160        ret.set_data(data);
161        ret.set_timestamp(timestamp);
162        ret.set_type(type_);
163        ret
164    }
165    #[cfg(feature = "EncodedAudioChunkType")]
166    #[doc = "Construct a new `EncodedAudioChunkInit`."]
167    #[doc = ""]
168    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"]
169    #[doc = ""]
170    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
171    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
172    pub fn new_with_u8_slice(
173        data: &mut [u8],
174        timestamp: i32,
175        type_: EncodedAudioChunkType,
176    ) -> Self {
177        #[allow(unused_mut)]
178        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
179        ret.set_data_u8_slice(data);
180        ret.set_timestamp(timestamp);
181        ret.set_type(type_);
182        ret
183    }
184    #[cfg(feature = "EncodedAudioChunkType")]
185    #[doc = "Construct a new `EncodedAudioChunkInit`."]
186    #[doc = ""]
187    #[doc = "*This API requires the following crate features to be activated: `EncodedAudioChunkInit`, `EncodedAudioChunkType`*"]
188    #[doc = ""]
189    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
190    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
191    pub fn new_with_u8_array(
192        data: &::js_sys::Uint8Array,
193        timestamp: i32,
194        type_: EncodedAudioChunkType,
195    ) -> Self {
196        #[allow(unused_mut)]
197        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
198        ret.set_data_u8_array(data);
199        ret.set_timestamp(timestamp);
200        ret.set_type(type_);
201        ret
202    }
203    #[cfg(web_sys_unstable_apis)]
204    #[deprecated = "Use `set_data()` instead."]
205    pub fn data(&mut self, val: &::js_sys::Object) -> &mut Self {
206        self.set_data(val);
207        self
208    }
209    #[cfg(web_sys_unstable_apis)]
210    #[deprecated = "Use `set_duration()` instead."]
211    pub fn duration(&mut self, val: u32) -> &mut Self {
212        self.set_duration(val);
213        self
214    }
215    #[cfg(web_sys_unstable_apis)]
216    #[deprecated = "Use `set_timestamp()` instead."]
217    pub fn timestamp(&mut self, val: i32) -> &mut Self {
218        self.set_timestamp(val);
219        self
220    }
221    #[cfg(web_sys_unstable_apis)]
222    #[deprecated = "Use `set_transfer()` instead."]
223    pub fn transfer(&mut self, val: &[::js_sys::ArrayBuffer]) -> &mut Self {
224        self.set_transfer(val);
225        self
226    }
227    #[cfg(web_sys_unstable_apis)]
228    #[cfg(feature = "EncodedAudioChunkType")]
229    #[deprecated = "Use `set_type()` instead."]
230    pub fn type_(&mut self, val: EncodedAudioChunkType) -> &mut Self {
231        self.set_type(val);
232        self
233    }
234}