Skip to main content

web_sys/features/
gen_AudioDecoderConfig.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 = AudioDecoderConfig)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `AudioDecoderConfig` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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 AudioDecoderConfig;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `codec` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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 = "codec")]
25    pub fn get_codec(this: &AudioDecoderConfig) -> ::alloc::string::String;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `codec` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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 = "codec")]
34    pub fn set_codec(this: &AudioDecoderConfig, val: &str);
35    #[cfg(web_sys_unstable_apis)]
36    #[doc = "Get the `description` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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, getter = "description")]
43    pub fn get_description(this: &AudioDecoderConfig) -> Option<::js_sys::Object>;
44    #[cfg(web_sys_unstable_apis)]
45    #[doc = "Change the `description` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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 = "description")]
52    pub fn set_description(this: &AudioDecoderConfig, val: &::js_sys::Object);
53    #[cfg(web_sys_unstable_apis)]
54    #[doc = "Change the `description` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
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    #[doc = "# Safety"]
61    #[doc = ""]
62    #[doc = "The `val` slice must outlive any use of the dictionary on the JavaScript side. wasm-bindgen passes a raw view into wasm linear memory — if the underlying data is freed or moved before JS is done reading the field, the behaviour is undefined. Prefer the `_array` variant (takes `&Uint8Array`) for a safe alternative that copies the data."]
63    #[wasm_bindgen(method, setter = "description")]
64    pub unsafe fn set_description_u8_slice(this: &AudioDecoderConfig, val: &mut [u8]);
65    #[cfg(web_sys_unstable_apis)]
66    #[doc = "Change the `description` field of this object."]
67    #[doc = ""]
68    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
69    #[doc = ""]
70    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
71    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
72    #[wasm_bindgen(method, setter = "description")]
73    pub fn set_description_u8_array(this: &AudioDecoderConfig, val: &::js_sys::Uint8Array);
74    #[cfg(web_sys_unstable_apis)]
75    #[doc = "Get the `numberOfChannels` field of this object."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
78    #[doc = ""]
79    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
80    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
81    #[wasm_bindgen(method, getter = "numberOfChannels")]
82    pub fn get_number_of_channels(this: &AudioDecoderConfig) -> u32;
83    #[cfg(web_sys_unstable_apis)]
84    #[doc = "Change the `numberOfChannels` field of this object."]
85    #[doc = ""]
86    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
87    #[doc = ""]
88    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
89    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
90    #[wasm_bindgen(method, setter = "numberOfChannels")]
91    pub fn set_number_of_channels(this: &AudioDecoderConfig, val: u32);
92    #[cfg(web_sys_unstable_apis)]
93    #[doc = "Get the `sampleRate` field of this object."]
94    #[doc = ""]
95    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
96    #[doc = ""]
97    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
98    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
99    #[wasm_bindgen(method, getter = "sampleRate")]
100    pub fn get_sample_rate(this: &AudioDecoderConfig) -> u32;
101    #[cfg(web_sys_unstable_apis)]
102    #[doc = "Change the `sampleRate` field of this object."]
103    #[doc = ""]
104    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
105    #[doc = ""]
106    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
107    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
108    #[wasm_bindgen(method, setter = "sampleRate")]
109    pub fn set_sample_rate(this: &AudioDecoderConfig, val: u32);
110}
111#[cfg(web_sys_unstable_apis)]
112impl AudioDecoderConfig {
113    #[doc = "Construct a new `AudioDecoderConfig`."]
114    #[doc = ""]
115    #[doc = "*This API requires the following crate features to be activated: `AudioDecoderConfig`*"]
116    #[doc = ""]
117    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
118    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
119    pub fn new(codec: &str, number_of_channels: u32, sample_rate: u32) -> Self {
120        #[allow(unused_mut)]
121        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
122        ret.set_codec(codec);
123        ret.set_number_of_channels(number_of_channels);
124        ret.set_sample_rate(sample_rate);
125        ret
126    }
127    #[cfg(web_sys_unstable_apis)]
128    #[deprecated = "Use `set_codec()` instead."]
129    pub fn codec(&mut self, val: &str) -> &mut Self {
130        self.set_codec(val);
131        self
132    }
133    #[cfg(web_sys_unstable_apis)]
134    #[deprecated = "Use `set_description()` instead."]
135    pub fn description(&mut self, val: &::js_sys::Object) -> &mut Self {
136        self.set_description(val);
137        self
138    }
139    #[cfg(web_sys_unstable_apis)]
140    #[deprecated = "Use `set_number_of_channels()` instead."]
141    pub fn number_of_channels(&mut self, val: u32) -> &mut Self {
142        self.set_number_of_channels(val);
143        self
144    }
145    #[cfg(web_sys_unstable_apis)]
146    #[deprecated = "Use `set_sample_rate()` instead."]
147    pub fn sample_rate(&mut self, val: u32) -> &mut Self {
148        self.set_sample_rate(val);
149        self
150    }
151}