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 [Throws] attributes to Streams API #3052

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_ByteLengthQueuingStrategy.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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>;
}
23 changes: 13 additions & 10 deletions crates/web-sys/src/features/gen_ReadableStream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ extern "C" {
this: &ReadableStream,
reason: &::wasm_bindgen::JsValue,
) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = getReader)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStream" , js_name = getReader)]
#[doc = "The `getReader()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"]
pub fn get_reader(this: &ReadableStream) -> ::js_sys::Object;
pub fn get_reader(this: &ReadableStream) -> Result<::js_sys::Object, JsValue>;
#[cfg(feature = "ReadableStreamGetReaderOptions")]
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = getReader)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStream" , js_name = getReader)]
#[doc = "The `getReader()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader)"]
Expand All @@ -91,17 +91,20 @@ extern "C" {
pub fn get_reader_with_options(
this: &ReadableStream,
options: &ReadableStreamGetReaderOptions,
) -> ::js_sys::Object;
) -> Result<::js_sys::Object, JsValue>;
#[cfg(feature = "ReadableWritablePair")]
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeThrough)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStream" , js_name = pipeThrough)]
#[doc = "The `pipeThrough()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeThrough)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"]
pub fn pipe_through(this: &ReadableStream, transform: &ReadableWritablePair) -> ReadableStream;
pub fn pipe_through(
this: &ReadableStream,
transform: &ReadableWritablePair,
) -> Result<ReadableStream, JsValue>;
#[cfg(all(feature = "ReadableWritablePair", feature = "StreamPipeOptions",))]
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeThrough)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStream" , js_name = pipeThrough)]
#[doc = "The `pipeThrough()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeThrough)"]
Expand All @@ -111,7 +114,7 @@ extern "C" {
this: &ReadableStream,
transform: &ReadableWritablePair,
options: &StreamPipeOptions,
) -> ReadableStream;
) -> Result<ReadableStream, JsValue>;
#[cfg(feature = "WritableStream")]
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = pipeTo)]
#[doc = "The `pipeTo()` method."]
Expand All @@ -132,11 +135,11 @@ extern "C" {
destination: &WritableStream,
options: &StreamPipeOptions,
) -> ::js_sys::Promise;
# [wasm_bindgen (method , structural , js_class = "ReadableStream" , js_name = tee)]
# [wasm_bindgen (catch , method , structural , js_class = "ReadableStream" , js_name = tee)]
#[doc = "The `tee()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/tee)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `ReadableStream`*"]
pub fn tee(this: &ReadableStream) -> ::js_sys::Array;
pub fn tee(this: &ReadableStream) -> Result<::js_sys::Array, JsValue>;
}
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_ReadableStreamByobReader.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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>;
}
Original file line number Diff line number Diff line change
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