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
//! [`WebTransportOptions`]
//!
//! <https://w3c.github.io/webtransport/#dictdef-webtransportoptions>
use wasm_bindgen::prelude::*;
extern crate alloc;
use super::*;
crate::dictionary_type! {
/// ```webidl
/// dictionary WebTransportOptions {
/// boolean allowPooling = false;
/// boolean requireUnreliable = false;
/// HeadersInit headers = {};
/// sequence<WebTransportHash> serverCertificateHashes = [];
/// WebTransportCongestionControl congestionControl = "default";
/// [EnforceRange] unsigned short? anticipatedConcurrentIncomingUnidirectionalStreams = null;
/// [EnforceRange] unsigned short? anticipatedConcurrentIncomingBidirectionalStreams = null;
/// sequence<DOMString> protocols = [];
/// ReadableStreamType datagramsReadableType;
/// };
/// ```
///
/// <https://w3c.github.io/webtransport/#dictdef-webtransportoptions>
pub type WebTransportOptions {
allow_pooling: bool => allowPooling
require_unreliable: bool => requireUnreliable
headers_raw: JsValue => headers
server_certificate_hashes: alloc::vec::Vec<WebTransportHash> => serverCertificateHashes
congestion_control: WebTransportCongestionControl => congestionControl
anticipated_concurrent_incoming_unidirectional_streams: u16 => anticipatedConcurrentIncomingUnidirectionalStreams
anticipated_concurrent_incoming_bidirectional_streams: u16 => anticipatedConcurrentIncomingBidirectionalStreams
protocols: alloc::vec::Vec<js_sys::JsString> => protocols
datagrams_readable_type: web_sys::ReadableStreamType => datagramsReadableType
}
}
impl WebTransportOptions {
/// Set the `headers` field from a [`web_sys::Headers`] object.
///
/// The `headers` field is a `HeadersInit`, so it can also be set to
/// a sequence of header name/value pairs or a string record via
/// [`Self::set_headers_raw`].
pub fn set_headers(&self, val: &web_sys::Headers) {
self.set_headers_raw(val.clone().into())
}
}