Skip to main content

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