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
use super::*;
/// The RTCDataChannel class.
/// [`RTCDataChannel`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct RTCDataChannel {
inner: EventTarget,
}
impl FromVal for RTCDataChannel {
fn from_val(v: &Any) -> Self {
RTCDataChannel {
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 RTCDataChannel {
type Target = EventTarget;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for RTCDataChannel {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for RTCDataChannel {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for RTCDataChannel {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<RTCDataChannel> for Any {
fn from(s: RTCDataChannel) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&RTCDataChannel> for Any {
fn from(s: &RTCDataChannel) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(RTCDataChannel);
impl RTCDataChannel {
/// Getter of the `label` attribute.
/// [`RTCDataChannel.label`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/label)
pub fn label(&self) -> JsString {
self.inner.get("label").as_::<JsString>()
}
}
impl RTCDataChannel {
/// Getter of the `ordered` attribute.
/// [`RTCDataChannel.ordered`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/ordered)
pub fn ordered(&self) -> bool {
self.inner.get("ordered").as_::<bool>()
}
}
impl RTCDataChannel {
/// Getter of the `maxPacketLifeTime` attribute.
/// [`RTCDataChannel.maxPacketLifeTime`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/maxPacketLifeTime)
pub fn max_packet_life_time(&self) -> u16 {
self.inner.get("maxPacketLifeTime").as_::<u16>()
}
}
impl RTCDataChannel {
/// Getter of the `maxRetransmits` attribute.
/// [`RTCDataChannel.maxRetransmits`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/maxRetransmits)
pub fn max_retransmits(&self) -> u16 {
self.inner.get("maxRetransmits").as_::<u16>()
}
}
impl RTCDataChannel {
/// Getter of the `protocol` attribute.
/// [`RTCDataChannel.protocol`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/protocol)
pub fn protocol(&self) -> JsString {
self.inner.get("protocol").as_::<JsString>()
}
}
impl RTCDataChannel {
/// Getter of the `negotiated` attribute.
/// [`RTCDataChannel.negotiated`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/negotiated)
pub fn negotiated(&self) -> bool {
self.inner.get("negotiated").as_::<bool>()
}
}
impl RTCDataChannel {
/// Getter of the `id` attribute.
/// [`RTCDataChannel.id`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/id)
pub fn id(&self) -> u16 {
self.inner.get("id").as_::<u16>()
}
}
impl RTCDataChannel {
/// Getter of the `readyState` attribute.
/// [`RTCDataChannel.readyState`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState)
pub fn ready_state(&self) -> RTCDataChannelState {
self.inner.get("readyState").as_::<RTCDataChannelState>()
}
}
impl RTCDataChannel {
/// Getter of the `bufferedAmount` attribute.
/// [`RTCDataChannel.bufferedAmount`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmount)
pub fn buffered_amount(&self) -> u32 {
self.inner.get("bufferedAmount").as_::<u32>()
}
}
impl RTCDataChannel {
/// Getter of the `bufferedAmountLowThreshold` attribute.
/// [`RTCDataChannel.bufferedAmountLowThreshold`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmountLowThreshold)
pub fn buffered_amount_low_threshold(&self) -> u32 {
self.inner.get("bufferedAmountLowThreshold").as_::<u32>()
}
/// Setter of the `bufferedAmountLowThreshold` attribute.
/// [`RTCDataChannel.bufferedAmountLowThreshold`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/bufferedAmountLowThreshold)
pub fn set_buffered_amount_low_threshold(&mut self, value: u32) {
self.inner.set("bufferedAmountLowThreshold", value);
}
}
impl RTCDataChannel {
/// Getter of the `onopen` attribute.
/// [`RTCDataChannel.onopen`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onopen)
pub fn onopen(&self) -> Any {
self.inner.get("onopen").as_::<Any>()
}
/// Setter of the `onopen` attribute.
/// [`RTCDataChannel.onopen`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onopen)
pub fn set_onopen(&mut self, value: &Any) {
self.inner.set("onopen", value);
}
}
impl RTCDataChannel {
/// Getter of the `onbufferedamountlow` attribute.
/// [`RTCDataChannel.onbufferedamountlow`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onbufferedamountlow)
pub fn onbufferedamountlow(&self) -> Any {
self.inner.get("onbufferedamountlow").as_::<Any>()
}
/// Setter of the `onbufferedamountlow` attribute.
/// [`RTCDataChannel.onbufferedamountlow`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onbufferedamountlow)
pub fn set_onbufferedamountlow(&mut self, value: &Any) {
self.inner.set("onbufferedamountlow", value);
}
}
impl RTCDataChannel {
/// Getter of the `onerror` attribute.
/// [`RTCDataChannel.onerror`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onerror)
pub fn onerror(&self) -> Any {
self.inner.get("onerror").as_::<Any>()
}
/// Setter of the `onerror` attribute.
/// [`RTCDataChannel.onerror`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onerror)
pub fn set_onerror(&mut self, value: &Any) {
self.inner.set("onerror", value);
}
}
impl RTCDataChannel {
/// Getter of the `onclosing` attribute.
/// [`RTCDataChannel.onclosing`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclosing)
pub fn onclosing(&self) -> Any {
self.inner.get("onclosing").as_::<Any>()
}
/// Setter of the `onclosing` attribute.
/// [`RTCDataChannel.onclosing`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclosing)
pub fn set_onclosing(&mut self, value: &Any) {
self.inner.set("onclosing", value);
}
}
impl RTCDataChannel {
/// Getter of the `onclose` attribute.
/// [`RTCDataChannel.onclose`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclose)
pub fn onclose(&self) -> Any {
self.inner.get("onclose").as_::<Any>()
}
/// Setter of the `onclose` attribute.
/// [`RTCDataChannel.onclose`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onclose)
pub fn set_onclose(&mut self, value: &Any) {
self.inner.set("onclose", value);
}
}
impl RTCDataChannel {
/// Getter of the `onmessage` attribute.
/// [`RTCDataChannel.onmessage`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onmessage)
pub fn onmessage(&self) -> Any {
self.inner.get("onmessage").as_::<Any>()
}
/// Setter of the `onmessage` attribute.
/// [`RTCDataChannel.onmessage`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/onmessage)
pub fn set_onmessage(&mut self, value: &Any) {
self.inner.set("onmessage", value);
}
}
impl RTCDataChannel {
/// Getter of the `binaryType` attribute.
/// [`RTCDataChannel.binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/binaryType)
pub fn binary_type(&self) -> BinaryType {
self.inner.get("binaryType").as_::<BinaryType>()
}
/// Setter of the `binaryType` attribute.
/// [`RTCDataChannel.binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/binaryType)
pub fn set_binary_type(&mut self, value: &BinaryType) {
self.inner.set("binaryType", value);
}
}
impl RTCDataChannel {
/// Getter of the `priority` attribute.
/// [`RTCDataChannel.priority`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/priority)
pub fn priority(&self) -> RTCPriorityType {
self.inner.get("priority").as_::<RTCPriorityType>()
}
}
impl RTCDataChannel {
/// The close method.
/// [`RTCDataChannel.close`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/close)
pub fn close(&self) -> Undefined {
self.inner.call("close", &[]).as_::<Undefined>()
}
}
impl RTCDataChannel {
/// The send method.
/// [`RTCDataChannel.send`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send)
pub fn send(&self, data: &JsString) -> Undefined {
self.inner.call("send", &[data.into()]).as_::<Undefined>()
}
}
impl RTCDataChannel {
/// The send method.
/// [`RTCDataChannel.send`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send)
pub fn send_with_data(&self, data: &Blob) -> Undefined {
self.inner.call("send", &[data.into()]).as_::<Undefined>()
}
}
impl RTCDataChannel {
/// The send method.
/// [`RTCDataChannel.send`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send)
pub fn send_with_data_2(&self, data: &ArrayBuffer) -> Undefined {
self.inner.call("send", &[data.into()]).as_::<Undefined>()
}
}
impl RTCDataChannel {
/// The send method.
/// [`RTCDataChannel.send`](https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/send)
pub fn send_with_data_3(&self, data: &Any) -> Undefined {
self.inner.call("send", &[data.into()]).as_::<Undefined>()
}
}