Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-sys: Added Streams API #3065

Merged
merged 11 commits into from Sep 6, 2022
15 changes: 13 additions & 2 deletions crates/web-sys/Cargo.toml
Expand Up @@ -150,6 +150,7 @@ BrowserElementExecuteScriptOptions = []
BrowserFeedWriter = []
BrowserFindCaseSensitivity = []
BrowserFindDirection = []
ByteLengthQueuingStrategy = []
Cache = []
CacheBatchOperation = []
CacheQueryOptions = []
Expand Down Expand Up @@ -223,6 +224,7 @@ ConvertCoordinateOptions = []
ConvolverNode = ["AudioNode", "EventTarget"]
ConvolverOptions = []
Coordinates = []
CountQueuingStrategy = []
Credential = []
CredentialCreationOptions = []
CredentialRequestOptions = []
Expand Down Expand Up @@ -973,18 +975,22 @@ PushSubscriptionKeys = []
PushSubscriptionOptions = []
PushSubscriptionOptionsInit = []
QueuingStrategy = []
QueuingStrategyInit = []
RadioNodeList = ["NodeList"]
Range = []
RcwnPerfStats = []
RcwnStatus = []
ReadableByteStreamController = []
ReadableStream = []
ReadableStreamByobReadResult = []
ReadableStreamByobReader = []
ReadableStreamDefaultReadResult = []
ReadableStreamByobRequest = []
ReadableStreamDefaultController = []
ReadableStreamDefaultReader = []
ReadableStreamGetReaderOptions = []
ReadableStreamIteratorOptions = []
ReadableStreamReadResult = []
ReadableStreamReaderMode = []
ReadableStreamType = []
ReadableWritablePair = []
RecordingState = []
ReferrerPolicy = []
Expand Down Expand Up @@ -1319,6 +1325,8 @@ TouchList = []
TrackEvent = ["Event"]
TrackEventInit = []
TransformStream = []
TransformStreamDefaultController = []
Transformer = []
TransitionEvent = ["Event"]
TransitionEventInit = []
Transport = []
Expand All @@ -1332,6 +1340,8 @@ UdpMessageEventInit = []
UdpOptions = []
UiEvent = ["Event"]
UiEventInit = []
UnderlyingSink = []
UnderlyingSource = []
Url = []
UrlSearchParams = []
Usb = ["EventTarget"]
Expand Down Expand Up @@ -1468,6 +1478,7 @@ Worklet = []
WorkletGlobalScope = []
WorkletOptions = []
WritableStream = []
WritableStreamDefaultController = []
WritableStreamDefaultWriter = []
XPathExpression = []
XPathNsResolver = []
Expand Down
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs
Expand Up @@ -18,13 +18,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`*"]
pub fn high_water_mark(this: &ByteLengthQueuingStrategy) -> f64;
# [wasm_bindgen (structural , method , getter , js_class = "ByteLengthQueuingStrategy" , js_name = size)]
# [wasm_bindgen (structural , catch , method , getter , js_class = "ByteLengthQueuingStrategy" , js_name = size)]
#[doc = "Getter for the `size` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ByteLengthQueuingStrategy/size)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ByteLengthQueuingStrategy`*"]
pub fn size(this: &ByteLengthQueuingStrategy) -> ::js_sys::Function;
pub fn size(this: &ByteLengthQueuingStrategy) -> Result<::js_sys::Function, JsValue>;
#[cfg(feature = "QueuingStrategyInit")]
#[wasm_bindgen(catch, constructor, js_class = "ByteLengthQueuingStrategy")]
#[doc = "The `new ByteLengthQueuingStrategy(..)` constructor, creating a new instance of `ByteLengthQueuingStrategy`."]
Expand Down
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_CountQueuingStrategy.rs
Expand Up @@ -18,13 +18,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`*"]
pub fn high_water_mark(this: &CountQueuingStrategy) -> f64;
# [wasm_bindgen (structural , method , getter , js_class = "CountQueuingStrategy" , js_name = size)]
# [wasm_bindgen (structural , catch , method , getter , js_class = "CountQueuingStrategy" , js_name = size)]
#[doc = "Getter for the `size` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CountQueuingStrategy/size)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `CountQueuingStrategy`*"]
pub fn size(this: &CountQueuingStrategy) -> ::js_sys::Function;
pub fn size(this: &CountQueuingStrategy) -> Result<::js_sys::Function, JsValue>;
#[cfg(feature = "QueuingStrategyInit")]
#[wasm_bindgen(catch, constructor, js_class = "CountQueuingStrategy")]
#[doc = "The `new CountQueuingStrategy(..)` constructor, creating a new instance of `CountQueuingStrategy`."]
Expand Down
32 changes: 20 additions & 12 deletions crates/web-sys/src/features/gen_ReadableByteStreamController.rs
Expand Up @@ -12,28 +12,30 @@ extern "C" {
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub type ReadableByteStreamController;
#[cfg(feature = "ReadableStreamByobRequest")]
# [wasm_bindgen (structural , method , getter , js_class = "ReadableByteStreamController" , js_name = byobRequest)]
# [wasm_bindgen (structural , catch , method , getter , js_class = "ReadableByteStreamController" , js_name = byobRequest)]
#[doc = "Getter for the `byobRequest` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/byobRequest)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`, `ReadableStreamByobRequest`*"]
pub fn byob_request(this: &ReadableByteStreamController) -> Option<ReadableStreamByobRequest>;
pub fn byob_request(
this: &ReadableByteStreamController,
) -> Result<Option<ReadableStreamByobRequest>, JsValue>;
# [wasm_bindgen (structural , method , getter , js_class = "ReadableByteStreamController" , js_name = desiredSize)]
#[doc = "Getter for the `desiredSize` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/desiredSize)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub fn desired_size(this: &ReadableByteStreamController) -> Option<f64>;
# [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = close)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableByteStreamController" , js_name = close)]
#[doc = "The `close()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/close)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub fn close(this: &ReadableByteStreamController);
# [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = enqueue)]
pub fn close(this: &ReadableByteStreamController) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableByteStreamController" , js_name = enqueue)]
#[doc = "The `enqueue()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/enqueue)"]
Expand All @@ -42,26 +44,32 @@ extern "C" {
pub fn enqueue_with_array_buffer_view(
this: &ReadableByteStreamController,
chunk: &::js_sys::Object,
);
# [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = enqueue)]
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableByteStreamController" , js_name = enqueue)]
#[doc = "The `enqueue()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/enqueue)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub fn enqueue_with_u8_array(this: &ReadableByteStreamController, chunk: &mut [u8]);
# [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = error)]
pub fn enqueue_with_u8_array(
this: &ReadableByteStreamController,
chunk: &mut [u8],
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableByteStreamController" , js_name = error)]
#[doc = "The `error()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/error)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub fn error(this: &ReadableByteStreamController);
# [wasm_bindgen (method , structural , js_class = "ReadableByteStreamController" , js_name = error)]
pub fn error(this: &ReadableByteStreamController) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableByteStreamController" , js_name = error)]
#[doc = "The `error()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableByteStreamController/error)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableByteStreamController`*"]
pub fn error_with_e(this: &ReadableByteStreamController, e: &::wasm_bindgen::JsValue);
pub fn error_with_e(
this: &ReadableByteStreamController,
e: &::wasm_bindgen::JsValue,
) -> Result<(), JsValue>;
}
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_ReadableStreamByobReader.rs
Expand Up @@ -46,13 +46,13 @@ extern "C" {
this: &ReadableStreamByobReader,
view: &mut [u8],
) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = releaseLock)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamBYOBReader" , js_name = releaseLock)]
#[doc = "The `releaseLock()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/releaseLock)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobReader`*"]
pub fn release_lock(this: &ReadableStreamByobReader);
pub fn release_lock(this: &ReadableStreamByobReader) -> Result<(), JsValue>;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBReader" , js_name = cancel)]
#[doc = "The `cancel()` method."]
#[doc = ""]
Expand Down
25 changes: 17 additions & 8 deletions crates/web-sys/src/features/gen_ReadableStreamByobRequest.rs
Expand Up @@ -18,21 +18,27 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"]
pub fn view(this: &ReadableStreamByobRequest) -> Option<::js_sys::Object>;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respond)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respond)]
#[doc = "The `respond()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respond)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"]
pub fn respond_with_u32(this: &ReadableStreamByobRequest, bytes_written: u32);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respond)]
pub fn respond_with_u32(
this: &ReadableStreamByobRequest,
bytes_written: u32,
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respond)]
#[doc = "The `respond()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respond)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"]
pub fn respond_with_f64(this: &ReadableStreamByobRequest, bytes_written: f64);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respondWithNewView)]
pub fn respond_with_f64(
this: &ReadableStreamByobRequest,
bytes_written: f64,
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respondWithNewView)]
#[doc = "The `respondWithNewView()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)"]
Expand All @@ -41,12 +47,15 @@ extern "C" {
pub fn respond_with_new_view_with_array_buffer_view(
this: &ReadableStreamByobRequest,
view: &::js_sys::Object,
);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respondWithNewView)]
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamBYOBRequest" , js_name = respondWithNewView)]
#[doc = "The `respondWithNewView()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBRequest/respondWithNewView)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamByobRequest`*"]
pub fn respond_with_new_view_with_u8_array(this: &ReadableStreamByobRequest, view: &mut [u8]);
pub fn respond_with_new_view_with_u8_array(
this: &ReadableStreamByobRequest,
view: &mut [u8],
) -> Result<(), JsValue>;
}
23 changes: 13 additions & 10 deletions crates/web-sys/src/features/gen_ReadableStreamDefaultController.rs
Expand Up @@ -18,21 +18,21 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"]
pub fn desired_size(this: &ReadableStreamDefaultController) -> Option<f64>;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultController" , js_name = close)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultController" , js_name = close)]
#[doc = "The `close()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/close)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"]
pub fn close(this: &ReadableStreamDefaultController);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultController" , js_name = enqueue)]
pub fn close(this: &ReadableStreamDefaultController) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultController" , js_name = enqueue)]
#[doc = "The `enqueue()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/enqueue)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"]
pub fn enqueue(this: &ReadableStreamDefaultController);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultController" , js_name = enqueue)]
pub fn enqueue(this: &ReadableStreamDefaultController) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultController" , js_name = enqueue)]
#[doc = "The `enqueue()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/enqueue)"]
Expand All @@ -41,19 +41,22 @@ extern "C" {
pub fn enqueue_with_chunk(
this: &ReadableStreamDefaultController,
chunk: &::wasm_bindgen::JsValue,
);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultController" , js_name = error)]
) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultController" , js_name = error)]
#[doc = "The `error()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/error)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"]
pub fn error(this: &ReadableStreamDefaultController);
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultController" , js_name = error)]
pub fn error(this: &ReadableStreamDefaultController) -> Result<(), JsValue>;
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultController" , js_name = error)]
#[doc = "The `error()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultController/error)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultController`*"]
pub fn error_with_e(this: &ReadableStreamDefaultController, e: &::wasm_bindgen::JsValue);
pub fn error_with_e(
this: &ReadableStreamDefaultController,
e: &::wasm_bindgen::JsValue,
) -> Result<(), JsValue>;
}
Expand Up @@ -33,13 +33,13 @@ extern "C" {
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"]
pub fn read(this: &ReadableStreamDefaultReader) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = releaseLock)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStreamDefaultReader" , js_name = releaseLock)]
#[doc = "The `releaseLock()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/releaseLock)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStreamDefaultReader`*"]
pub fn release_lock(this: &ReadableStreamDefaultReader);
pub fn release_lock(this: &ReadableStreamDefaultReader) -> Result<(), JsValue>;
# [wasm_bindgen (method , structural , js_class = "ReadableStreamDefaultReader" , js_name = cancel)]
#[doc = "The `cancel()` method."]
#[doc = ""]
Expand Down